In order to convert std::wstring
to UTF-8 I use the following code:
std::wstring my_wide_string = L"my_sqlite_db.db";
std::wstring_convert<std::codecvt_utf8<wchar_t> > myconv;
myconv.to_bytes( my_wide_string.c_str() );
Now, I need to do a back conversion, ie UTF-8 to std::wstring
.
What is the proper way to switch the converter?
Why not just use from_bytes()
the reverse function:
std::wstring test = myconv.from_bytes(myutf8);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.