-
-
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
cyryllic symbols #1064
Comments
The input to |
I compile with "/Zc:twoPhase- /utf-8" |
In your example, there are no quotes around auto main( ) -> int
{
setlocale(0, "ru");
std::cout << nlohmann::json::parse(std::string("{ \"happy\": \"тест\", \"pi\": 3.141 }")) << std::endl;
Sleep(INT_MAX);
} ? |
it works now but returns a weird value |
Does your shell support UTF-8? Could you try the following: auto j = nlohmann::json::parse(std::string("{ \"happy\": \"тест\", \"pi\": 3.141 }"));
std::string j_dump = j.dump(); And then check in the debugger which bytes are stored in |
Can you please give the exact bytes stored (best as hex value)? |
These bytes are UTF-8, so the library correctly parses and stores the string. Then it seems as if your system (shell, IDE, ...) does not correctly displays UTF-8. |
For note, the C++ spec only allows for the lower ASCII range in source files, outside of that is extensions and is not technically proper/valid C++ (rather it is undefined behaviour, which some compilers may treat as expected, but it could do whatever). However yeah, your terminal emulator is not displaying UTF-8 properly (it looks like it displays it as extended ASCII, not UTF-8). |
@eksponvt Do you need further assistance? |
No, thanks for help |
if I replace "тест" with English symbols, program doesnt throw an exception
screenshot:
The text was updated successfully, but these errors were encountered: