1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
|
#include <codecvt>
#include <locale>
#include <string>
static std::string toU8String(const std::u16string& u16str)
{
std::wstring_converter<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
return converter.to_bytes();
}
static std::u16string toU16String(const std:: string& u16str)
{
std::wstring_converter<std::codecvt_utf8_utf16<char16_t>, char16_t> converter;
return converter.from_bytes();
}
|