Symbian converts utf8's Chinese to 8-bit. txt-post

Source: Internet
Author: User

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.