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 » General IBM MQ Support » Some characteres are being added to message automatically

Post new topic  Reply to topic
 Some characteres are being added to message automatically « View previous topic :: View next topic » 
Author Message
radedipa
PostPosted: Mon Feb 13, 2012 9:57 pm    Post subject: Some characteres are being added to message automatically Reply with quote

Newbie

Joined: 13 Feb 2012
Posts: 3

I am using .net 4.0.
The message i have is in string format suppose
string message = "Test";
I am using writebytes method like
mq.WriteBytes(message);

the message that i see on Mq is "T.e.s.t"
a special character with hex value '00' is being added after every character.
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 13, 2012 10:41 pm    Post subject: Re: Some characteres are being added to message automaticall Reply with quote

Grand High Poobah

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

radedipa wrote:
I am using .net 4.0.
The message i have is in string format suppose
string message = "Test";
I am using writebytes method like
mq.WriteBytes(message);

the message that i see on Mq is "T.e.s.t"
a special character with hex value '00' is being added after every character.


What is the CCSID of the message?
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
radedipa
PostPosted: Mon Feb 13, 2012 10:43 pm    Post subject: Reply with quote

Newbie

Joined: 13 Feb 2012
Posts: 3

I did not set CCSID
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Mon Feb 13, 2012 10:46 pm    Post subject: Reply with quote

Grand High Poobah

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

radedipa wrote:
I did not set CCSID

And you're answering a question I did not ask...
_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
mqsiuser
PostPosted: Tue Feb 14, 2012 12:18 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

You have different codepages on Windows and MQ. You need to find out about them. A dot means "there is a byte (8 bits )". Look into Hex to find out more.

I use RFH-Util or ultraedit.

Codepage (conversion) etc can become painful.

I guess Windows writes UTF-16 (hence 16 bit, while one byte is empty for normal characters) and MQ interprets it as UTF-8 (hence an "empty byte" - zeros!)
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
radedipa
PostPosted: Tue Feb 14, 2012 12:57 am    Post subject: Reply with quote

Newbie

Joined: 13 Feb 2012
Posts: 3

Yes i can see '00' after each character when seen in hex format.
The conclusion is i should use "UTF-8" instead of "UTF-16" which is default for .net
Back to top
View user's profile Send private message
mqsiuser
PostPosted: Tue Feb 14, 2012 1:05 am    Post subject: Reply with quote

Yatiri

Joined: 15 Apr 2008
Posts: 637
Location: Germany

radedipa wrote:
Yes i can see '00' after each character when seen in hex format.
The conclusion is i should use "UTF-8" instead of "UTF-16" which is default for .net


If you live in Europe or the USA use UTF-8. If you live in Asia use UTF-16

.NET uses UTF-16 because it is world-wide... (probably you should not change it :-/)

Anyway... there also have been people thinking that they have codepage problems, but they actually didn't !

Some tools just always display the bytes (8 bit), eventhough single "displayable" characters consist of 16 bit (e.g. for UTF-16). E.g. RFH-Util always displays bytes (and the character for it, I guess it is always 8-bit american ASCII ?!).

I am not sure if MQ should display anything else there. Probably everything is fine with the way the bytes are displayed at {whereever you are looking there } !?!
_________________
Just use REFERENCEs
Back to top
View user's profile Send private message
rekarm01
PostPosted: Tue Feb 14, 2012 3:43 am    Post subject: Re: Some characteres are being added to message automaticall Reply with quote

Grand Master

Joined: 25 Jun 2008
Posts: 1415

radedipa wrote:
I am using .net 4.0.
The message i have is in string format suppose
string message = "Test";
I am using writebytes method like
mq.WriteBytes(message);

the message that i see on Mq is "T.e.s.t"

Consult the documentation for MQMessage to determine the difference between WriteBytes(), WriteChars(), and WriteString(), and their relation to the CharacterSet (ccsid) property.

mqsiuser wrote:
I guess Windows writes UTF-16 (hence 16 bit, while one byte is empty for normal characters) and MQ interprets it as UTF-8 (hence an "empty byte" - zeros!)

What a Windows application writes depends on which methods and properties it uses; what MQ interprets depends on the resulting MQ headers.
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic  Reply to topic Page 1 of 1

MQSeries.net Forum Index » General IBM MQ Support » Some characteres are being added to message automatically
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.