UTF8 to/from wide char conversion in STL

后端 未结 10 911
面向向阳花
面向向阳花 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:03

    I don't think there's a portable way of doing this. C++ doesn't know the encoding of its multibyte characters.

    As Chris suggested, your best bet is to play with codecvt.

提交回复
热议问题