utf-8
C / C++ / MFC
4
Posts
4
Posters
0
Views
1
Watching
-
Can you tell me the function to convert ansi string to utf-8 string?
-
Can you tell me the function to convert ansi string to utf-8 string?
Have you tried
MultiByteToWideChar()
orWideCharToMultiByte()
?
"The largest fire starts but with the smallest spark." - David Crow
"Judge not by the eye but by the heart." - Native American Proverb
-
Can you tell me the function to convert ansi string to utf-8 string?
If no other solutions, I think you can try successive calls of
MultiByteToWideChar
andWideCharToMultiByte
. First call converts the ANSI string to Unicode format, and then the second call converts to UTF-8 format:char ansi[] = "Ansi String"; wchar_t unicode[100]; char utf8[100]; MultiByteToWideChar(CP_ACP, 0, ansi, -1, unicode, 100); WideCharToMultiByte(CP_UTF8, 0, unicode, -1, utf8, 100, NULL, NULL);
Hope it works.
-
Can you tell me the function to convert ansi string to utf-8 string?