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 API Support » Add French characters properly

Post new topic  Reply to topic
 Add French characters properly « View previous topic :: View next topic » 
Author Message
ECoast
PostPosted: Wed Aug 09, 2006 9:40 am    Post subject: Add French characters properly Reply with quote

Newbie

Joined: 26 Oct 2005
Posts: 9
Location: Canada

Using MQ Client for .NET with C#. Does anyone know how to write a string containing french characters properly into the queue. When I attempt to add the string, the french characters are replaced by invalid characters. For example, when I add the string "My name is Frédéric", it appears as "My name is F.r.0.d.0.r.i.c.". I get spaces and my french characters are converted. Any ideas?
_________________
ECoast
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 09, 2006 10:02 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Unicode is a double-byte character format.

.NET strings are Unicode strings.

Those aren't spaces.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ECoast
PostPosted: Wed Aug 09, 2006 11:08 am    Post subject: Invalid french characters. Reply with quote

Newbie

Joined: 26 Oct 2005
Posts: 9
Location: Canada

Yes, I aware of the unicode, but how do one convert a unicode french string that can be used to write to the queue and appear properly.
_________________
ECoast
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 09, 2006 11:15 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

The only thing you have demonstrated is actually broken - or at a minimum "not working the way you think it does" - is the thing that is displaying your string as "My name is F.r.0.d.0.r.i.c.".

Everything else, including your code that writes the message AND MQ, may be working just fine.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ECoast
PostPosted: Wed Aug 09, 2006 11:23 am    Post subject: Reply with quote

Newbie

Joined: 26 Oct 2005
Posts: 9
Location: Canada

Yes, that corrrect, writing to the queue is not the problem, the string I have and what actually gets written is not the same and it causing a problem. The client receiving my message received what is written on the queue and not the original string I sent.

I was hoping someone who already attempt to write a unicode french string to a message queue can tell me how they did it using C#.
_________________
ECoast
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 09, 2006 11:40 am    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

Please post the output of amqsbcg against a message that your program wrote to the queue.

Again, you haven't shown that your writing code is doing the wrong thing.

All you've shown is that the reading code is either reading the message wrong (as plain text instead of unicode) or is displaying the message wrong.

And if you search here for ".NET" and "Unicode", you might find some helpful hints, too.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ECoast
PostPosted: Wed Aug 09, 2006 11:53 am    Post subject: Reply with quote

Newbie

Joined: 26 Oct 2005
Posts: 9
Location: Canada

Below is a sniplet of the code that writes a message to the queue (Note I'm now converting to UTF8:

string sNewMessage = "Frédéric";
UTF8Encoding utf8 = new UTF8Encoding();
byte[] encodedBytes = utf8.GetBytes(sNewMessage);
sNewMessage = utf8.GetString(encodedBytes);

int openOptions = MQC.MQOO_OUTPUT;

MQQueue inputToDAADQueue = queueManager.AccessQueue(edtInputQueueName.Text.Trim(), openOptions);

MQMessage messageToSend = new MQMessage ();
messageToSend.WriteBytes(sNewMessage);

messageToSend.Format = MQC.MQFMT_STRING;
MQPutMessageOptions pmo = new MQPutMessageOptions();
pmo.Options = MQC.MQGMO_CONVERT;

inputToDAADQueue.Put(messageToSend, pmo);
inputToDAADQueue.Close();
queueManager.Disconnect();

The output from command aqmsbcgc in my DOS windows is:

'Fr?d?ric '
_________________
ECoast
Back to top
View user's profile Send private message
jefflowrey
PostPosted: Wed Aug 09, 2006 12:15 pm    Post subject: Reply with quote

Grand Poobah

Joined: 16 Oct 2002
Posts: 19981

For the third time, there is no evidence that your WRITING code was WRONG. So why did you change it?

And you decided not to post the IMPORTANT part of the amqsbcgc output, which is the BYTE values.

Let me try, one more time.

You need to determine if the byte values of the message data ON THE QUEUE are wrong.

This will tell you if the problem is in the code that is WRITING the message, or in the code that is READING the message.

Until you do that, you don't know where the problem is.

And, again, this exact problem (except for the fact that your Unicode data is French characters) has been discussed here before. It is worth your time to look for that previous discussion.
_________________
I am *not* the model of the modern major general.
Back to top
View user's profile Send private message
ECoast
PostPosted: Wed Aug 09, 2006 12:22 pm    Post subject: Reply with quote

Newbie

Joined: 26 Oct 2005
Posts: 9
Location: Canada

The output from the DOS windows displays this

00000000: 4672 E964 E972 6963 'Fr0d0ric '

Is it possible the DOS windows cannot display these characters? When I export the output to text file and open it in notepad, it displays properly.
_________________
ECoast
Back to top
View user's profile Send private message
fjb_saper
PostPosted: Wed Aug 09, 2006 1:34 pm    Post subject: Reply with quote

Grand High Poobah

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

The unicode value for é is 00E9 and the corresponding ASCII value is E9 as well (source = MSWord)
So from what we can see your message is correct on the queue. However the DOS value for it might be different. Remember to look up your correspondance tables and give us the CCSID of the message.

Looks to me you have an ANSI => DOS conversion problem (I don't think amqsbcg does the browse with the convert option...)


_________________
MQ & Broker admin
Back to top
View user's profile Send private message Send e-mail
tleichen
PostPosted: Thu Aug 10, 2006 11:50 am    Post subject: Reply with quote

Yatiri

Joined: 11 Apr 2005
Posts: 663
Location: Center of the USA

I wish I had a dollar for every time I had to deal with something like this.

Look at the data in hex and verify that the hex representation is what it is supposed to be. As far as displaying the characters the way you want them to be, that is purely a function of what tool you are using to display the data and whether or not it is codeset aware. It is also a function of what codesets and/or fonts are available on the machine. There has to be a way of setting the codeset/font for whatever display tool is being used.
_________________
IBM Certified MQSeries Specialist
IBM Certified MQSeries Developer
Back to top
View user's profile Send private message
ECoast
PostPosted: Thu Aug 10, 2006 11:57 am    Post subject: Reply with quote

Newbie

Joined: 26 Oct 2005
Posts: 9
Location: Canada

Thank-you so-much all for your help. Very much appreciated.
_________________
ECoast
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 » IBM MQ API Support » Add French characters properly
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.