Chinese character encoding verification accuracy in xerces-C Development

Source: Internet
Author: User

Some friends often use xerces-C development programs to generate GBK or gb2312 encoded XML packets. The Chinese characters are encoded as follows, with the file name test. xml:

<? XML version = "1.0" encoding = "GBK" standalone = "no"?>
<Interboss>

<Userinfo>
<Bizcode> 125829999 </bizcode>
<Prodname> & # xc5; & # xa9; & # xd5; & # xfe; & # XCD; Evaluate </prodname>
<Servcode> 1258299993100001 </servcode>
<Userdata>
<Mobnum> 13777451607 </mobnum>
<Oprcode> 01 </oprcode>
<Efftt> 20090101 </efftt>
</Userdata>
</Userinfo>

</Interboss>

How to verify that the Chinese character encoding conversion in the message is correct. If the Chinese character encoding in prodname can be correctly displayed through a program, it proves that the conversion is correct.

In the xerces-C example, domprint can print XML files of different encoding formats and display them correctly.

Verification Method: run the following command to verify test. xml

./Domprint-wenc = iso8859-1 test. xml

If Chinese characters can be accurately printed on the screen, the encoding of Chinese characters in the generated message is correct.

If garbled characters are printed, there is a problem with the generated packets. Check carefully that the encoding conversion is not completed in the code.

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.