File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Websphere and the fly likes Bytes getting misinterpreted.. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Websphere
Bookmark "Bytes getting misinterpreted.." Watch "Bytes getting misinterpreted.." New topic

Bytes getting misinterpreted..

Jayant Raj
Ranch Hand

Joined: Mar 11, 2004
Posts: 42

I have a situation wherin I am firing MQ requests to a backend system to get some data. The data is a string on the backend system 'Credit 1 [1000] '.
The MQ server uses character encoding ISO-8859-1.

However, when this data is read by a Websphere 5 environment, I get 'Credit 1 �1000! ' back.
The same when read by a Websphere 6 environment gives me 'Credit 1 000! '.

How do i resolve this? I have tried setting the 'client.encoding.override' to ISO-8859-1 / UTF-8 in the Websphere server.. But no success!!!

regards,<br />Jayant Raj<br /> <br />SCJP 1.4 [98%]<br />SCWCD 1.4 [91%]<br />SCBCD [In Progress]
Paul Clapham

Joined: Oct 14, 2005
Posts: 19973

This isn't a minor difference between ISO-8859-1 and UTF-8; in fact ISO-8859-1 is a subset of UTF-8 in the sense that they both encode characters in the same way if they encode them at all.

The changes to [ and ] suggest to me that there is some kind of EBCDIC-based encoding going on somewhere. Those are basic ASCII characters so the only thing that could change them like that is something completely different from ASCII.
William Brogden
Author and all-around good cowpoke

Joined: Mar 22, 2000
Posts: 13036
when this data is read by a Websphere 5 environment

Read using what code?

Do you have any way to dump the binary values of the characters in the backend system string?

Jayant Raj
Ranch Hand

Joined: Mar 11, 2004
Posts: 42
Paul & William.. Many thanks for the response.
I have java code deployed in Websphere 5 & 6 servers that fires a MQ message to get the data from the backend. I get a byte[] back & I convert the same to a string & then parse it for information.
Do you reckon it is something to do with the character sets used in the JVM of the servers?
If yes, how do I change the character set used?

Paul Sturrock

Joined: Apr 14, 2004
Posts: 10336

Sounds like a WebSphere question. I'll move this to the WebSphere forum, you might get more responses there.

JavaRanch FAQ HowToAskQuestionsOnJavaRanch
Hanumanth Kanthi
Ranch Hand

Joined: May 27, 2004
Posts: 74
'client.encoding.override' to ISO-8859-1 / UTF-8

After setting the above, it should work... I am surprise.....

Did you restarted the server after making above changes to the JVM? If not, pl. do so and see how that affects...

H. Kanthi
I agree. Here's the link:
subject: Bytes getting misinterpreted..
It's not a secret anymore!