The conversions are straightforward, google should help here ...
That's it. Use UTF8String wherever memory is precious and for all UTF-8 I/O. Use UCS2String wherever the string must be parsed and/or manipulated. You can convert between those two representations any time.
Alternatives & Improvements
conversions from & to single-byte character encodings (e.g. ISO-8859-1) can be realized with help of plain translation tables, e.g. const wchar_t tt_iso88951[256] = {0,1,2,...}; and appropriate code for conversion to & from UCS2.
if UCS-2 is not sufficient, than switch to UCS-4 (typedef std::basic_string<uint32_t> UCS2String)
Windows OS使用UCS2/UTF-16作为其文件名,因此无论您的代码页如何,您都可以拥有具有任何Unicode字符的文件。但这意味着要访问或创建代码页上没有字符的文件,您必须使用std::wstring。没有其他方法。这是Microsoft对std::fstream的特定扩展,因此可能无法在其他系统上编译。如果您使用std::字符串,那么您只能使用仅包含代码页上字符的文件名。