Skip to content

Parse error: json.exception.parse_error.101 - invalid string: ill-formed UTF-8 byte #2014

Description

@SConnectTeam

Hi,

We work with extensions, communicating the browser with native code (C++).

I am trying to parse a string. One of the values is: "password":"Testé$".
The parse fails with the following error:

invalid parameters JSON string ([json.exception.parse_error.101] parse error at line 1, column 53: syntax error while parsing value - invalid string: ill-formed UTF-8 byte; last read: '"Testé$')"

The problem seems to be the é character, however the password is a valid UTF-8 string.

Strange thing:
It is parsed correctly while working with Chrome, but fails with the attached error while working with IE.

I am using version 3.7.3.

Many thanks

Activity

  1. nickaein commented on Mar 31, 2020

    @nickaein
    Contributor

    It seems that on IE, the necessary metadata isn't provided to the HTTP server so that the contents are parsed as UTF-8. You might have to explicitly set them inside JS script that sends the request.

  2. nlohmann commented on Mar 31, 2020

    @nlohmann
    Owner

    @nickaein is right. Please check if the input you pass to the library is properly UTF-8 encoded.

  3. nlohmann commented on Apr 11, 2020

    @nlohmann
    Owner

    @SConnectTeam Anything we can do for this issue?

  4. SConnectTeam commented on Apr 22, 2020

    @SConnectTeam
    Author

    Hi @nlohmann, thanks for the response.
    As a feature it would be nice if the Parse can manage the encoding.
    Our code uses 2 open source JSON libraries (unfortunately, different developers wrote it), one of them is this one.
    The other library is a lot less user friendly but manages to parse the string.
    Now we are facing 2 options: use the other library and change the entire project or handle encoding and use this one.

  5. nlohmann commented on Apr 22, 2020

    @nlohmann
    Owner

    Sorry about this. This library only supports UTF-8, which is the right choice in my opinion, see http://utf8everywhere.org.

  6. added
    solution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)
    on Apr 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    kind: questionsolution: wontfixthe issue will not be fixed (either it is impossible or deemed out of scope)

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions