CStringW=Unicode is?
Char *=ANSI is?
Would be *=Unicode is?
CStringA<- & gt; CStringW?
CStringA<- & gt; Char *?
CStringW<- & gt; Would be *?
CStringW<- & gt; Char * is that ok?
CStringA<- & gt; Would be * is that ok?
Char * & lt; - & gt; Would be * is that ok?
What utf-8 and use that identifier variable declaration?
CodePudding user response:
C + + 11, utf-8 is a multi-byte encoding method, is also a basic span bytes with a char * so,const char * utf8_string=u8 "Chinese characters";
Utf-8 also is a kind of Unicode, Windows above Unicode is utf - 16,
Because Windows API itself no utf8 version, so need to transform, of course, utf each other conversions of
Code is very simple, most of us can write, so generally higher conversion efficiency.
Would be c/c + + wide character type, standards are not the actual encoding, like
C + + 11 specific provisions utf-8, utf - 16, utf - 32 characters () is mandatory encoding
auto a=u8 'U'.
Auto b=u 'T';
Auto c=U 'F';
A - & gt; Char, b - & gt; Char16_t, c - & gt; char32_t
CodePudding user response:
Unicode is a concept, is an abstract, concrete implementation utf8, utf16, utf32, including Windows core is utf16 - little endian format,Cstrings don't love with, because haven't CStringA and W, have no the class,
CodePudding user response:
CSingA and CSgingW=operator can convert each other,CodePudding user response:
Is right in front, different character sets with CA2W and CW2A transformationCodePudding user response:
How to check some information, only thoroughly understand the character set and encoding, to give an answer,3 floor 4 floor of method, problems in special circumstances, such as system under the code of the program under the Japanese system with Chinese, may be garbled,
Its code page is dependent on your system registry, or rely on your application locale initialization,
Second floor word is not much, but the amount of information is too large, you baidu once more, read a few blog, understanding,
CodePudding user response:
For computer no noise, only the binary bytes; To the human brain is gibberish, GBK: 0 xb0 0 xa1, Unicode - 16 LE: 0 x4a 0 x55, Unicode - 16 BE: 0 x55 0 x4a, utf-8 8-0 x95 xE5 0 0 x8aCodePudding user response:
CStringA, and CStringW can directly transfers between internal automatic conversion code, of course, the early VS without this featureCStringA and char * can directly use, operator overloading and the structure function overloading to ensure that this is a
CStringW and would be * can be directly used, ditto
Char * and would be * transfers can make use of the first article, the conversion process, char * - & gt; CStringA - & gt; CStringW - & gt; Would be *
Can also use the macro WSTR=CA2W (CSTR) CSTR=CW2A (WSTR)