Home C C++ Java Python Perl PHP SQL JavaScript Linux Selenium QT Online Test

Home » Forum » x-Forum » Question

Is there a standard way to convert between string, wstring

I'm looking for a standard way to convert between string, wstring, and the unicode strings. I have code to convert the unicode strings between each other (ie. utf8 -> utf16, utf8 -> utf32, etc...) which is straightforward as they don't depend on the compiler, platform, etc... What I need is to convert string to wstring, wstring to string, and both to any (or all) of the unicode strings.

Up till now I've been using MultiByteToWideChar() and WideCharToMultiByte() with the code page set to either CP_ACP or CP_UTF8 as necessary. Of course this is windows only and I'd like to move to a platform agnostic method.

Posted by umeshamin 2020-07-06 02:44:57

No Ans Posted

Please login to comment

Log In


Ask New Question