You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
My server is returning the following as shown in PostMan:
{
"status": "FEL: Det valda objektet för händelsen"
}
In C++ VS2019, reading as a wstring is perfect but if I call response.extract_utf8_string() the JSON has messed up characters, in exactly the same way if I use utility::conversions:
std::string status = "unknown";
if (json.has_string_field(L"status"))
{
auto tmp = json[L"status"].as_string();
status = utility::conversions::to_utf8string(tmp);
}
tmp: L"FEL: Det valda objektet för händelsen"
status: "FEL: Det valda objektet för händelsen"
I need to use this value in a std::exception which only takes std::string what is the correct way to convert and why isn't utf8 working in the first place, when that's how the content is being encoded in the response?
The text was updated successfully, but these errors were encountered:
jdx-john
changed the title
Non-ASCII characters not converted properly in http_response.extract_utf8_string
Non-ASCII characters not converted properly in http_response.extract_utf8_string in MSVC 2019
May 16, 2023
My server is returning the following as shown in PostMan:
In C++ VS2019, reading as a
wstring
is perfect but if I call response.extract_utf8_string() the JSON has messed up characters, in exactly the same way if I use utility::conversions:tmp: L"FEL: Det valda objektet för händelsen"
status: "FEL: Det valda objektet för händelsen"
I need to use this value in a
std::exception
which onlytakes std::string
what is the correct way to convert and why isn't utf8 working in the first place, when that's how the content is being encoded in the response?The text was updated successfully, but these errors were encountered: