Convert const char* to wstring

后端 未结 7 772
难免孤独
难免孤独 2020-12-03 01:24

I\'m working on a native extension for a zinc based flash application and I need to convert a const char* to a wstring.

This is my code:

7条回答
  •  借酒劲吻你
    2020-12-03 01:51

    You need a library that can encode/decode UTF8. Unfortunately, this functionality isn't included with the std c++ library. Here's one library you might use: http://utfcpp.sourceforge.net/

    Here's an example use of it:

    utf8::utf8to32(bytes.begin(), bytes.end(), std::back_inserter(wstr));
    

提交回复
热议问题