ASG
IBM
Zystems
Cressida
Icon
Netflexity
 
  MQSeries.net
Search  Search       Tech Exchange      Education      Certifications      Library      Info Center      SupportPacs      LinkedIn  Search  Search                                                                   FAQ  FAQ   Usergroups  Usergroups
 
Register  ::  Log in Log in to check your private messages
 
RSS Feed - WebSphere MQ Support RSS Feed - Message Broker Support

MQSeries.net Forum Index » IBM MQ Java / JMS » Codepage trouble JMSTextmessage

Post new topic  Reply to topic
 Codepage trouble JMSTextmessage « View previous topic :: View next topic » 
Author Message
ThomasT
PostPosted: Sun Apr 23, 2006 6:02 am    Post subject: Codepage trouble JMSTextmessage Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

Hallo!

I have the following problem:
I receive a JMS message (MQSeries) with encoded with Codepage 850.
My Client receives/converts this to Cp1252.
In the JMSTextMessage there's an protected field saying "Cp850".

It would be problematic and dirty, but not impossible to have access to this protected field. BUT:

Another messsage is created from another system and there the copepage field says "UTF-8" and its not UTF-8 but (I think) Cp1252 as well. (maybe an other Cp).

So I have no change when I call in JAVA
String s = message.getText();
to receive the correct convertet text.
getText() seems to make in implizit conversion of the message bytes by calling new String(messagebytes, CODEPAGE) without any correlation to the Codepagefield in the message.

What I need are the real bytes of the message, but from a Textmessage.

The problem happend because the sender send us UTF-8. An there are trouble with german characters like äöü. The UTF-8 coding of these ChaRACTERS are not transported transperantly over this channel. All mentioned Codepages differs in the uppder bytes used by UTF-8 encoding.

I workaround would be:

String text = message.getText();
text = new String(text.getBytes(CODEPAGE), "UTF-8");

But I have no possibiliy to estimate the CODEPAGE with which the jave string was actually build. With which codepgage the messagebyte where interpreted.

I hope you understand my problem.

Greetings Thomas
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Sun Apr 23, 2006 11:47 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

Have you thought about checking into the BytesMessage method. Is there a readUTF() ?

You really have to look at how the putting application writes to the message and sets the message format.... Can you tell what the putting application does?

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
ThomasT
PostPosted: Tue Apr 25, 2006 1:56 am    Post subject: Reply with quote

Novice

Joined: 23 Apr 2006
Posts: 12

fjb_saper wrote:
Have you thought about checking into the BytesMessage method. Is there a readUTF() ?

You really have to look at how the putting application writes to the message and sets the message format.... Can you tell what the putting application does?

Enjoy


I tried nealy everything. But some of the methods are undocumented! (e.g. _exportBody).

I cannot say what the sender application does. I worst case, the codepage and bytes have nothing to do with each other...

getText() seems to interprete the bytes of the message, but I don't understand how.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Tue Apr 25, 2006 3:07 am    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

ThomasT wrote:
fjb_saper wrote:
Have you thought about checking into the BytesMessage method. Is there a readUTF() ?

You really have to look at how the putting application writes to the message and sets the message format.... Can you tell what the putting application does?

Enjoy


I tried nealy everything. But some of the methods are undocumented! (e.g. _exportBody).

I cannot say what the sender application does. I worst case, the codepage and bytes have nothing to do with each other...

getText() seems to interprete the bytes of the message, but I don't understand how.


Read the manuals. What JMS is doing is a get with conversion option set. As this is a Text message conversion is done from the native CCSID / Encoding of the source system to the CCSID/Encoding of the client.

In fact you need to look at the CCSID conversion tables. Encoding really applies to the least significant/most significant bit if dealing with numbers and you would not convert.
Text conversion is done via the CCSID conversion tables. If you need your text unconverted you need to look at BytesMessage and possibly ask the sending system not to set the format to MQSTR...

Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mvic
PostPosted: Tue Apr 25, 2006 3:33 am    Post subject: Reply with quote

Jedi

Joined: 09 Mar 2004
Posts: 2080

fjb_saper wrote:
Read the manuals. What JMS is doing is a get with conversion option set.

Last time I looked, no conversion was done in MQ's JMS classes, except (if I remember correctly) when reading RFH or RFH2 response messages from a broker. I'm interested : where did you see (or read) that JMS does conversion?
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Apr 26, 2006 2:29 pm    Post subject: Reply with quote

Grand High Poobah

Joined: 18 Nov 2003
Posts: 20756
Location: LI,NY

mvic wrote:
fjb_saper wrote:
Read the manuals. What JMS is doing is a get with conversion option set.

Last time I looked, no conversion was done in MQ's JMS classes, except (if I remember correctly) when reading RFH or RFH2 response messages from a broker. I'm interested : where did you see (or read) that JMS does conversion?
Check out the TextMessage Class.
The conversion is done for you behind the scenes because
Code:
String mytext = txtmsg.getText();
returns a readable string.
On some calls (depending on client CCSID, server CCSID, message CCSID you may get a JMSException that boils down to a "could not convert"....
Enjoy
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » IBM MQ Java / JMS » Codepage trouble JMSTextmessage
Jump to:  



You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Protected by Anti-Spam ACP
 
 


Theme by Dustin Baccetti
Powered by phpBB © 2001, 2002 phpBB Group

Copyright © MQSeries.net. All rights reserved.