Closed felipegodias closed 9 months ago
Calling dump when having a UTF-8 non ASCII character throws an exception.
An exception should not be thrown, the dump should contain the character without issue.
std::string s = "Á"; nlohmann::json j; j["value"] = s; try { std::string json_out = j.dump(); std::cout << json_out << std::endl; } catch (const std::exception& e) { std::cerr << e.what() << std::endl; }
[json.exception.type_error.316] invalid UTF-8 byte at index 0: 0xC1
MSVC version '19.38.33130.0' Windows 11
3.11.2
develop
Especially with MSVC, I don't think that literal string is UTF-8 encoded.
@felipegodias Can you please provide more information. In particular, please double-check your input is actually UTF-8 encoded.
Description
Calling dump when having a UTF-8 non ASCII character throws an exception.
Reproduction steps
Expected vs. actual results
An exception should not be thrown, the dump should contain the character without issue.
Minimal code example
Error messages
Compiler and operating system
MSVC version '19.38.33130.0' Windows 11
Library version
3.11.2
Validation
develop
branch is used.