Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

core: Add support of non-UTF-8 encodings to the form loader #13346

Merged
merged 4 commits into from
Jun 26, 2024

Commits on Jun 26, 2024

  1. core: Add support of non-UTF-8 encodings to the form loader

    Flash's form loader loads text files in the local system codepage if
    System#useCodepage has been set to true. Previously, Ruffle always
    (wrongly) used UTF-8, leading to incorrectly displayed characters.
    This has been fixed. Ruffle now supports loading files with an encoding
    other than UTF-8.
    As Ruffle doesn't always have access to the system codepage and as it's
    not reliably the correct encoding, the crate chardetng has been added.
    It's used instead of the system codepage to detect the encoding, and the
    data is converted into UTF-8.
    Korne127 authored and adrian17 committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    60753dc View commit details
    Browse the repository at this point in the history
  2. core: Use HTTP response encoding if existing

    If System#useCodepage has been set to true, the form loader now uses the
    encoding specified in the HTTP response content type field, if existing,
    to decode remote text files. chardetng is now (only) used if the HTTP
    response doesn't specify any encoding or if the file is local.
    Korne127 authored and adrian17 committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    04d9229 View commit details
    Browse the repository at this point in the history
  3. core: Make the form loader use Windows-1252 if SWF version <= 5

    The form loader now loads files using Windows-1252 if the SWF version is
    smaller than 6. This roughly matches Flash's behaviour (Flash uses
    Windows-1252 on Windows, on macOS a slightly different custom encoding
    is used).
    Previously, UTF-8 has been (wrongly) used for all SWF files if
    System#useCodepage hasn't been set to true, leading to incorrectly
    displayed characters.
    Korne127 authored and adrian17 committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    caab999 View commit details
    Browse the repository at this point in the history
  4. tests: Add form loader encoding tests

    Several form loader encoding tests have been added. They test whether
    the form loader uses the correct encoding to decode text files with
    different SWF versions and settings.
    One test has been marked as known failure as it tests how Flash decodes
    invalid UTF-8 characters (when decoding as UTF-8), which is not yet
    implemented in Ruffle.
    Korne127 authored and adrian17 committed Jun 26, 2024
    Configuration menu
    Copy the full SHA
    a086621 View commit details
    Browse the repository at this point in the history