dimanche 24 avril 2016

How to do back conversion

In order to convert std::wstring to char* UTF8 I use 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, i.e. char* UTF8 to std::wstring.

What is the proper way to switch the converter?

Thank you.

Aucun commentaire:

Enregistrer un commentaire