Author |
Message
|
naresh_mg |
Posted: Sun Jun 28, 2009 7:38 pm Post subject: Reading the chinese characters from the Queue |
|
|
Newbie
Joined: 28 Jun 2009 Posts: 2
|
Dear,
I am not able to read the Chinese characters from the queue.I have done some character set configuration and all. Please help me for the same.
regards
Naresh Govindaswamy.
 |
|
Back to top |
|
 |
fjb_saper |
Posted: Sun Jun 28, 2009 8:26 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Dear, what have you tried and to what result?  _________________ MQ & Broker admin |
|
Back to top |
|
 |
naresh_mg |
Posted: Sun Jun 28, 2009 8:45 pm Post subject: |
|
|
Newbie
Joined: 28 Jun 2009 Posts: 2
|
Dear All,
This is what that i have posted to Queue
<?xml version="1.0" encoding="utf-8" ?>
- <BUEBBS>
- <HEADER>
<TAG>0000</TAG>
<CTYCD>CN</CTYCD>
<PSID>DL</PSID>
<SYSCD>EBBSSTS</SYSCD>
<INTFN>PRH</INTFN>
<DATE>090624</DATE>
<TIME>174944</TIME>
<BSDT>090624</BSDT>
</HEADER>
- <DETAIL>
<TAG>1000</TAG>
<BKCD>10310000</BKCD>
<BICCD>10310000414</BICCD>
<BKNM>中国农业银行北京八里桥支行103100004142</BKNM>
<BNKADD>朝阳区京通路双桥段北侧</BNKADD>
<CTYCD>CN</CTYCD>
<CLRCD>AHMD</CLRCD>
<ACTF>D</ACTF>
</DETAIL>
- <DETAIL>
<TAG>1000</TAG>
<BKCD>10310000</BKCD>
<BICCD>10310000416</BICCD>
<BKNM>中国农业银行朝阳支行营业部ceshi103100004167</BKNM>
<BNKADD>朝阳区工体南路东草园1号</BNKADD>
<CTYCD>CN</CTYCD>
<CLRCD>AHMD</CLRCD>
<ACTF>M</ACTF>
</DETAIL>
- <DETAIL>
<TAG>1000</TAG>
<BKCD>10373109</BKCD>
<BICCD>10373109999</BICCD>
<BKNM>中国农业银行云南省分行清算中心103731099997</BKNM>
<BNKADD>昆明市人民中路1 号</BNKADD>
<CTYCD>CN</CTYCD>
<CLRCD>AHMD</CLRCD>
<ACTF>M</ACTF>
</DETAIL>
- <TRAILER>
<HATT>3</HATT>
</TRAILER>
</BUEBBS>
####################
After that This is how i listen the queue.
MQMessage retrievedMessage = new MQMessage();
retrievedMessage.messageId = hello_world.messageId;
MQGetMessageOptions gmo = new MQGetMessageOptions();
system_default_local_queue.get(retrievedMessage, gmo);
retrievedMessage.format=MQC.MQFMT_STRING;
retrievedMessage.characterSet=1200;
String msgText = retrievedMessage.readString(retrievedMessage.getDataLength());
after populating the values form the queue my output XML is like this,
<?xml version="1.0" encoding="utf-8"?><BUEBBS><HEADER><TAG>0000</TAG><CTYCD>CN</CTYCD><PSID>DL</PSID><SYSCD>EBBSSTS</SYSCD><INTFN>PRH</INTFN><DATE>090624</DATE><TIME>174944</TIME><BSDT>090624</BSDT></HEADER><DETAIL><TAG>1000</TAG><BKCD>10310000</BKCD><BICCD>10310000414</BICCD><BKNM>ä¸ÂÃ¥?½å??ä¸?é?¶è¡?Ã¥??京å?«é??æ¡¥æ?¯è¡?103100004142</BKNM><BNKADD>æ??é?³å?ºäº¬é??è·¯å??桥段å??ä¾§</BNKADD><CTYCD>CN</CTYCD><CLRCD>AHMD</CLRCD><ACTF>D</ACTF></DETAIL><DETAIL><TAG>1000</TAG><BKCD>10310000</BKCD><BICCD>10310000416</BICCD><BKNM>ä¸ÂÃ¥?½å??ä¸?é?¶è¡?æ??é?³æ?¯è¡?è?¥ä¸?é?¨ceshi103100004167</BKNM><BNKADD>æ??é?³å?ºå·¥ä½?Ã¥??è·¯ä¸?è??Ã¥?Â1Ã¥?·</BNKADD><CTYCD>CN</CTYCD><CLRCD>AHMD</CLRCD><ACTF>M</ACTF></DETAIL><DETAIL><TAG>1000</TAG><BKCD>10373109</BKCD><BICCD>10373109999</BICCD><BKNM>ä¸ÂÃ¥?½å??ä¸?é?¶è¡?äº?Ã¥??ç??Ã¥??è¡?æ¸?ç®?ä¸Âå¿?103731099997</BKNM><BNKADD>æ??æ??å¸?人æ°?ä¸Âè·¯1 Ã¥?·</BNKADD><CTYCD>CN</CTYCD><CLRCD>AHMD</CLRCD><ACTF>M</ACTF></DETAIL><TRAILER><HATT>3</HATT></TRAILER></BUEBBS>
Please help me out of this.
Regards
Naresh Govindaswamy.  |
|
Back to top |
|
 |
harish_td |
Posted: Sun Jun 28, 2009 9:50 pm Post subject: |
|
|
Master
Joined: 13 Feb 2006 Posts: 236
|
naresh_mg wrote: |
<?xml version="1.0" encoding="utf-8" ?> |
What happens when you use 1208 [UTF-8] instead of
naresh_mg wrote: |
retrievedMessage.characterSet=1200; |
You can read about the different CCSID's here
http://www-01.ibm.com/software/globalization/cdra/appendix_k.jsp
Why not use readUTF and writeUTF methods instead of reading as String? |
|
Back to top |
|
 |
rekarm01 |
Posted: Mon Jun 29, 2009 2:25 am Post subject: Re: Reading the chinese characters from the Queue |
|
|
Grand Master
Joined: 25 Jun 2008 Posts: 1415
|
naresh_mg wrote: |
This is what that i have posted to Queue |
How? Which ccsid does the MQPUT application put in the MQ header?
naresh_mg wrote: |
<?xml version="1.0" encoding="utf-8" ?>
...
<BKNM>中国农业银行北京八里桥支行103100004142</BKNM>
...
####################
after populating the values form the queue my output XML is like this,
...
<BKNM>ä¸ÂÃ¥?½å??ä¸?é?¶è¡?Ã¥??京å?«é??æ¡¥æ?¯è¡?103100004142</BKNM>
... |
It looks as if, at some point, the message is encoded using utf-8 (ccsid=1208), but decoded as if it were iso8859-1 (ccsid=819):
Quote: |
'中国 ...' --(utf-8)--> X' e4 b8 ad e5 9b bd ...' --(iso8859-1)--> 'ä¸<SHY>ÂÃ¥<CSI>½ ...' |
Two possible explanations:- the MQPUT application describes the message using the wrong ccsid (should use 1208, not 819)
- or, the message is correct, but the displaying application is misconfigured (should display as utf-8, not iso8859-1)
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Jun 29, 2009 11:14 am Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
I can think of a third one:
The message is received somewhere on the route with a convert and translated from the original CCSID to 819 loosing thus characters that cannot be represented....  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|