Why are some characters converted to unicode in exported JSON files?

Follow

Comments

5 comments

  • Avatar
    Vasliii A

    I need unescaped version of the JSON output

    2
    Comment actions Permalink
  • Avatar
    jo wende (Edited )

    Special characters like ä,ü,ö are valid in json, there is absolutely no need to replace them. It blows up the code and makes it less read- and searchable in a big translation file. At least this replacement should be optionally

    0
    Comment actions Permalink
  • Avatar
    Geoffrey

    This article is absolutely useless, it only explains why but not how to deal with the conversion, for example, we pull the translation file, and then what? any suggested bash scripts or commands to actually do the job? The problem is with the Chinese project management running this development over in North point, no one has a brain on their heads to consider the real users of the system.

    1
    Comment actions Permalink
  • Avatar
    Judith Massey (Edited )

    Hello

    Accentuated characters are escaped because of the nature of JSON formats. Most of JSON decoding logic accepts both escaped and non-escaped text to obtain the same result. Therefore OneSky outputs the escaped version to avoid potential problems (e.g. unicode encoding issues) for some languages and frameworks.

    Dinar Chronicles Update

    0
    Comment actions Permalink
  • Avatar
    Harry Edward

    To preserve UTF-8 and accentuated characters when downloading a JSON file, ensure that your JSON export settings or the method you're using to generate the JSON file supports UTF-8 encoding. This typically involves:

    1. Encoding Declaration: Confirm that your JSON file starts with `"charset": "UTF-8"` in its metadata or the appropriate encoding declaration.

    2. Export Method: If you're using a programming language or tool to generate the JSON file (such as Python, JavaScript, or a backend framework), ensure that it explicitly handles UTF-8 encoding during file generation.

    3. Content-Type Header: When serving the JSON file via a web server, set the `Content-Type` header to `"application/json; charset=utf-8"` to ensure proper encoding.

    By adhering to these practices, you should be able to download JSON files while preserving UTF-8 and accentuated characters accurately.

    0
    Comment actions Permalink

Please sign in to leave a comment.