Author |
Message
|
radedipa |
Posted: Mon Feb 13, 2012 9:57 pm Post subject: Some characteres are being added to message automatically |
|
|
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 |
|
 |
fjb_saper |
Posted: Mon Feb 13, 2012 10:41 pm Post subject: Re: Some characteres are being added to message automaticall |
|
|
 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 |
|
 |
radedipa |
Posted: Mon Feb 13, 2012 10:43 pm Post subject: |
|
|
Newbie
Joined: 13 Feb 2012 Posts: 3
|
|
Back to top |
|
 |
fjb_saper |
Posted: Mon Feb 13, 2012 10:46 pm Post subject: |
|
|
 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 |
|
 |
mqsiuser |
Posted: Tue Feb 14, 2012 12:18 am Post subject: |
|
|
 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 |
|
 |
radedipa |
Posted: Tue Feb 14, 2012 12:57 am Post subject: |
|
|
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 |
|
 |
mqsiuser |
Posted: Tue Feb 14, 2012 1:05 am Post subject: |
|
|
 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 |
|
 |
rekarm01 |
Posted: Tue Feb 14, 2012 3:43 am Post subject: Re: Some characteres are being added to message automaticall |
|
|
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 |
|
 |
|