Author |
Message
|
madurairaja |
Posted: Fri Oct 09, 2015 11:32 am Post subject: Reading arabic characters using mq connection |
|
|
Newbie
Joined: 09 Oct 2015 Posts: 3
|
Dears,
I am reading xml data using MQ connection that contains some arabic characters. But in the log4j log file it shows some junk characters like زÙ?اد سعÙ?د Ø£ØÂÙ. Also the same junk values are used in further usage of same program. Please help to read the proper arabic characters values and to display the same chars in log4j file.
Mq configuration details are,
MQEnvironment.channel=SYSTEM.ADMIN.SVRCONN
MQEnvironment.CCSID=1208
Thanks & Regards,
Raja Mohammed |
|
Back to top |
|
 |
Vitor |
Posted: Fri Oct 09, 2015 11:40 am Post subject: Re: Reading arabic characters using mq connection |
|
|
 Grand High Poobah
Joined: 11 Nov 2005 Posts: 26093 Location: Texas, USA
|
madurairaja wrote: |
MQEnvironment.channel=SYSTEM.ADMIN.SVRCONN |
You should never use a system channel for any application connection.
madurairaja wrote: |
MQEnvironment.CCSID=1208 |
Does this match the CCSID of the message? Have you coded for any kind of conversion to occur, specifically any conversion from the code page of the message to the code page of the OS where the log4j file is being written and which I'll bet (from personal experience and your posted results) is an ISO-Latin code page that doesn't support Arabic?
Or in summary:
what did you attempt that led you to believe the Arabic characters should be properly handled? _________________ Honesty is the best policy.
Insanity is the best defence. |
|
Back to top |
|
 |
madurairaja |
Posted: Fri Oct 09, 2015 12:10 pm Post subject: |
|
|
Newbie
Joined: 09 Oct 2015 Posts: 3
|
Operating System used is AIX, Application server is IBM websphere and Java 7.
Now I tried changing log4j property value to
log4j.appender.mqlogfile.encoding=UTF-8
And after testing I received XML response with Nickname tag value like below
<Nickname>زياد سعيد Ø£ØÂÂمد خدرج</Nickname><FullName>ziad sayd</FullName>
Both channel & CCSID values are recommended by IBM MQ administrator.
Please suggest if I need to modify anything. |
|
Back to top |
|
 |
tczielke |
Posted: Sat Oct 10, 2015 6:16 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
The issue might be with what you are using to view the file.
For example, I am using SecureCRT with a Linux server. The LOCALE is set to en_US.UTF-8, so it does support UTF-8 data.
I have a file that has these 4 Arabic UTF-8 bytes in it in hex:
d8 a1 d8 a2 d8 a3 d8 a4 0a
These are UTF-8 bytes for:
x'd8a1' = Arabic letter hamza
x'd8a2' = Arabic letter alef with madda above
x'd8a3' = Arabic letter alef with hamza above
x'd8a4' = Arabic letter waw with hamza above
However, when I cat this file, I get what looks like garabage data. Checking the Appearance in the Session Options for SecureCRT, I see the Character Encoding is set to Default. When I change it to UTF-8 and then cat the file, now I see the arabic characters.
So that is something to check. Is your shell (i.e. LOCALE) set to support UTF-8? Is your tool for accessing the Unix server (i.e. SecureCRT) set to display the data in UTF-8?
Another option is just to transfer the file to a Windows server and view it in a browser or editor that supports UTF-8. That worked for me, as well. _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
madurairaja |
Posted: Sun Oct 18, 2015 10:33 am Post subject: |
|
|
Newbie
Joined: 09 Oct 2015 Posts: 3
|
Thank you very much for your useful information. I used code now like strNickName = new String(strNickName.getBytes(),Charset.forName("UTF-8")); It is working fine now. |
|
Back to top |
|
 |
tczielke |
Posted: Sun Oct 18, 2015 11:30 am Post subject: |
|
|
Guardian
Joined: 08 Jul 2010 Posts: 941 Location: Illinois, USA
|
You are welcome! Glad to hear you got it working. _________________ Working with MQ since 2010. |
|
Back to top |
|
 |
|