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.