Symbian converts utf8's Chinese to 8-bit. txt
This problem may not be very practical, because it is very good to store UTF8 Chinese characters with 8-bit descriptors, but because I have recently read a lot of posts about descriptor conversion and Chinese display, I still have this question, I hope someone can answer this question ~~~~~
First, I know that resource files have many benefits, but I don't need to use these benefits... I save the CPP file as UTF-8 encoded.
_ LIT8 (KName, "hao China ");
TBuf8 <30> buf8 (KName );
Buf8 contains 9 Characters and 9 bytes. The Chinese character of a UTF-8 occupies 3 bytes.
When you want to display it, You can convert it to display it.
TBuf <30> des;
CnvUtfConverter: ConvertToUnicodeFromUtf8 (des, buf );
User: InfoPrint (des );
The result des contains 3 Characters and 6 bytes. The Chinese character of a Unicode occupies two bytes.
However
_ Timeout (KName, "haokan China ");
TBuf <30> buf (KName );
User: InfoPrint (buf );
In this way, the display is OK.
The buf length is 9 and the size is 18. This is the Chinese character of UTF8 stored with a 16-bit descriptor. The 16-bit descriptor expands the original Chinese character (including three 8-bit characters) into six 8-bit characters. I don't know how to perform the conversion, it does not seem as simple as converting each of the original three bytes into two bytes.
At this time, is there any way to convert the buf into an 8-bit UTF8 encoded descriptor?