Home > Software engineering >  Consult a character string coding problem
Consult a character string coding problem

Time:09-17

I want to realize such a function, that is, a string, GBK encoding a Duan Zhongwen want to use utf encoding, I don't need this piece of string to display properly on the computer, I just want to realize the encoding, you can achieve

CodePudding user response:

https://blog.csdn.net/dyzhen/article/details/46224925

https://www.cnblogs.com/findumars/p/7252858.html

CodePudding user response:

MultiByteToWideChar (CP_UTF8, 0, buffer, len, wBuf, len);
WideCharToMultiByte (CP_ACP, 0, wBuf, len, szBuf, len, 0, 0).

CodePudding user response:

Char STR []="d ten thousand";//ANSI
Char str8 [20]={0};
Int len=9;//
WCHAR wBuf [20]={0};
MultiByteToWideChar (CP_ACP, 0, STR, len, wBuf, len);//ANSI 2 unicode
WideCharToMultiByte (CP_UTF8, 0, wBuf, len, str8, len, 0, 0).//unicode to utf8
//str8="E4 B8 81 E4 B8 80 E4 B8 87"//basically 3 bytes characters

CodePudding user response:

You are misunderstood, what I want is a whole string of a certain period of use utf8 encoding
Instead of the whole into utf8 encoding

CodePudding user response:

Split the string, processing finished stitching merger bai again


  • Related