-
-
Notifications
You must be signed in to change notification settings - Fork 6.8k
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
Dump throwing exception #1416
Comments
Yes, the library only supports UTF-8, see the README:
The error handlers are described here. The library does not do re-encoding, because this is a very hard thing to do. |
So, just to clarify please, any strings I pass to the json object must be UTF-8 encoded beforehand? |
Yes. |
The encoding used for string literals ( Many OS's (and their compilers) natively use UTF-8 so all of this just works. However, I'm guessing you're on Windows, which has a rich history on the topics of codepages, Unicode, etc. I don't know if there's a way to ask MSVC to read your source files as UTF-8, but you could look around (eg, this StackOverflow question). Doing that could cuase you other headaches as this could break how you interact with other non-UTF-8 libraries. You might have some luck using the C++11 |
@Duchex Do you need further assistance? |
Thank you for the help all. Encoding to UTF-8 before passing to the JSON object solved the issue. It might be worth clarifying this in the readme since when you say
It does not expliciltly say that in order to get dump to work, you must use UTF-8 encoded strings in the JSON object when strings are used. Anyway, thank you for a great library. It works really well. |
Well, "only supports UTF-8" and "strings with different encodings" should be clear. |
Hi
If I run the following code, the dump method throws an exception:
I understand that the json library uses UTF8, but why does it not encode what I give it into its correct format please? (or am I expcected to do that?)
The text was updated successfully, but these errors were encountered: