Author |
Message
|
fredand44 |
Posted: Tue Oct 31, 2006 7:18 am Post subject: Corrupted chars |
|
|
Acolyte
Joined: 14 Feb 2006 Posts: 63
|
Hello!
We are trying to send a BytesMessage that consists of a XML-string.
In this XML there is som swedish chars for eg ÅÄÖ.
We are sending this JMS-message from a weblogic to MQ and when they arrive at MQ the chars seems to be corrupted.
Do you guys know how to solve this?
I guess we need to set the encoding in some how at the JMS-level.
The XML-string has this encoding but I do not think that matter on the JMS-level:
<?xml version="1.0" encoding="utf-8"?>
We have tried
byteMessage.setStringProperty("Content-Type", "text/xml; charset=utf-8")
But that throws a Exception:
Illegal property name, 'Content-Type'
Any input or ideas would be great!
Best regards
Fredrik |
|
Back to top |
|
 |
jefflowrey |
Posted: Tue Oct 31, 2006 7:52 am Post subject: |
|
|
Grand Poobah
Joined: 16 Oct 2002 Posts: 19981
|
So what you're saying is that you are trying to create a message that contains characters from two different character sets (UTF-8 and "Swedish"), and you want MQ to convert the UTF-8 stuff fine and ignore the Swedish stuff? _________________ I am *not* the model of the modern major general. |
|
Back to top |
|
 |
fjb_saper |
Posted: Tue Oct 31, 2006 7:54 pm Post subject: |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
Send only UTF-8 data and set the message's CCSID to 1208 (UTF- .
Make sure you define the format as MQSTR.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
fredand44 |
Posted: Tue Oct 31, 2006 11:34 pm Post subject: Hello! |
|
|
Acolyte
Joined: 14 Feb 2006 Posts: 63
|
Hello!
Thanks for your replies!
1) I guess that the chars "ÅÄÖ" in swedish exists in UTF-8. There fore I guess it should be ok to just to create a message with a string with theses chars. But they do not arrive as "ÅÄÖ". Perhaps I ave missed something fundamental?
2) Do you know how to, in JMS, to "Send only UTF-8 data and set the message's CCSID to 1208 (UTF-.
Make sure you define the format as MQSTR. " ... This sound s very interesting. We have tried:
bytesMessage.writeUTF("ÅÄÖ");
...but this is perhaps not enough?
Best regards
Fredrik |
|
Back to top |
|
 |
fredand44 |
Posted: Tue Oct 31, 2006 11:52 pm Post subject: Is JMSAdmin the place?? |
|
|
Acolyte
Joined: 14 Feb 2006 Posts: 63
|
|
Back to top |
|
 |
fredand44 |
Posted: Thu Nov 02, 2006 1:06 am Post subject: Looks like TextMessage solve this. |
|
|
Acolyte
Joined: 14 Feb 2006 Posts: 63
|
Hello!
We tried to send TextMessages instead of BytesMessage and then it looks like the chars is correct.
We tried with the CCSID but that did not seems to do anything.
Best regards
Fredrik |
|
Back to top |
|
 |
mvic |
Posted: Thu Nov 02, 2006 2:08 am Post subject: Re: Looks like TextMessage solve this. |
|
|
 Jedi
Joined: 09 Mar 2004 Posts: 2080
|
fredand44 wrote: |
We tried with the CCSID but that did not seems to do anything. |
If you want us to comment meaningfully you should consider posting data dumps showing data in/out of your system. |
|
Back to top |
|
 |
fjb_saper |
Posted: Thu Nov 02, 2006 3:16 am Post subject: Re: Looks like TextMessage solve this. |
|
|
 Grand High Poobah
Joined: 18 Nov 2003 Posts: 20756 Location: LI,NY
|
fredand44 wrote: |
Hello!
We tried to send TextMessages instead of BytesMessage and then it looks like the chars is correct.
We tried with the CCSID but that did not seems to do anything.
Best regards
Fredrik |
Well that's the way to go. TextMessage will set the format to MQSTR.
Setting the chars in native of the source system, will work.
Now JMS will retrieve the message with the conversion flag. So on the other end you are doing a GET with CONVERT and that will translate the characters if the CCSID is not the same.
A BytesMessage never gets translated from one char set to the other as a byte has the same value whatever the system.
Enjoy  _________________ MQ & Broker admin |
|
Back to top |
|
 |
|