UTF8 to/from wide char conversion in STL

后端 未结 10 904
面向向阳花
面向向阳花 2020-11-22 06:48

Is it possible to convert UTF8 string in a std::string to std::wstring and vice versa in a platform independent manner? In a Windows application I would use MultiByteToWideC

10条回答
  •  时光取名叫无心
    2020-11-22 07:12

    You can use the codecvt locale facet. There's a specific specialisation defined, codecvt that may be of use to you, although, the behaviour of that is system-specific, and does not guarantee conversion to UTF-8 in any way.

提交回复
热议问题