Convert char string to UTF-8
-
I want to convert char[] string to UTF-8. How should I use int MultiByteToWideChar() and WideCharToMultiByte() to do such convertion? And if I should not use the two function to resolve such task,but how should I do? Thanks. GOOD LUCK
First use MultiByteToWideChar() to convert the char string from your local code page to wide char, then use WideCharToMultiByte() to convert the wide char string to UTF8. You may use CP_ACP for your local code page, and code page for utf-8 is 1200. But I've never tried the conversion between wide char and utf-8, so I'm not sure whether it would succeed.
-
I want to convert char[] string to UTF-8. How should I use int MultiByteToWideChar() and WideCharToMultiByte() to do such convertion? And if I should not use the two function to resolve such task,but how should I do? Thanks. GOOD LUCK
-
First use MultiByteToWideChar() to convert the char string from your local code page to wide char, then use WideCharToMultiByte() to convert the wide char string to UTF8. You may use CP_ACP for your local code page, and code page for utf-8 is 1200. But I've never tried the conversion between wide char and utf-8, so I'm not sure whether it would succeed.