Change strings conversion function

This commit is contained in:
Mikhail Lobotskiy
2024-03-15 18:16:58 +04:00
parent be0c6b13e7
commit b2c8696d1d

View File

@ -1,7 +1,7 @@
#include "json_values.h" #include "json_values.h"
#include <locale> // for string <=> wstring conversion
#include <codecvt> #include "../../common/File.h"
namespace NSJSON namespace NSJSON
{ {
@ -119,8 +119,7 @@ namespace NSJSON
if (m_type == ptStringW) if (m_type == ptStringW)
{ {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; return U_TO_UTF8(m_wstring);
return std::string(converter.to_bytes(m_wstring));
} }
#ifdef JSON_DEBUG #ifdef JSON_DEBUG
@ -136,8 +135,7 @@ namespace NSJSON
if (m_type == ptStringA) if (m_type == ptStringA)
{ {
std::wstring_convert<std::codecvt_utf8_utf16<wchar_t>> converter; return UTF8_TO_U(m_string);
return std::wstring(converter.from_bytes(m_string));
} }
#ifdef JSON_DEBUG #ifdef JSON_DEBUG