Original Message:
Sent: Fri February 09, 2024 09:10 AM
From: Rich Harran
Subject: CCSID Code pages CHCP and display Euro symbol €
Doing a put and a get to a local queue with these samples won't result in MQ doing any data conversion. All three samples do put or get with the CodedCharSetId (CCSID) in the MQMD set to MQCCSI_Q_MGR, and only amqsget specifies the get with convert option anyway.
The bytes that are put are what amqsput0 has in its buffer as a result of calling fgets() on stdin, and what happens at the terminal is a result of amqsget calling printf() on the data that has passed through MQ unchanged. amqsbcg converts non-printable single-byte characters into '.' so it can handle non-text data, and will show the hex values of the individual bytes.
I think you have found that CCSID 858 is suitable for your application and terminal, but 65001 (utf-8) is not. This might be because fgets() and/or printf() are not suitable for multi-byte utf-8 characters on Windows (I don't know).
You also seem to see that setting the terminal CCSID to 858 and the queue manger CCSID to 850 works well (and you would see the same for any queue manager CCSID). However, the CCSID in the MQMD for the message won't be correct for the data. If an application did a get with convert specifying a different CCSID than the queue manager CCSID, the data would be converted from the queue manager CCSID when it is actually in 858. This is because amqsput is setting the CCSID to MQCCSI_Q_MGR.
A real application should set the CCSID to match the data for MQPUT and can set the required CCSID for MQGET and request get with convert. If you do that, then you could set the queue manager CCSID to 1208 and the terminal and application CCSID to 858.
You can use the client versions of the samples, amqsputc and amqsgetc and these will treat MQCCSI_Q_MGR as the CCSID of the client environment which should also work. This still won't mean that there's any data conversion done by MQ, because the CCSID in the MQMD in the message will be set to 858, the get will request conversion to 858, so no conversion is needed.
------------------------------
Rich Harran
Original Message:
Sent: Fri February 09, 2024 06:30 AM
From: Joao Ramires
Subject: CCSID Code pages CHCP and display Euro symbol €
Thanks Tim and Francois!
If I change CHCP to 858 (in DOS command prompt) do the amqsput / get the € is displayed correctly. If I change CHCP tp 65001 and queue manager CCSID to 1208, I have two issues: in DOS command prompt portuguese characters are not correctly displayed, and some become control characters, and the € symbol isn't correctly displayed.
First case:
C:\Users\Joao>chcpActive code page: 858C:\Users\Joao>echo dis qmgr ccsid | runmqsc MQSENDER 1 : dis qmgr ccsid QMNAME(MQSENDER) CCSID(850)...C:\Users\Joao>echo "123 ABC #$€" | amqsput QL1 MQSENDERSample AMQSPUT0 starttarget queue is QL1Sample AMQSPUT0 endC:\Users\Joao>amqsget QL1 MQSENDERSample AMQSGET0 startmessage <"123 ABC #$€" >
Second case (note the get hangs on "#$â" I need a ctrl-c to break)
C:\Users\Joao>chcpActive code page: 65001C:\Users\Joao>echo dis qmgr ccsid | runmqsc MQSENDER 1 : dis qmgr ccsidAMQ8408I: Informaç QMNAME(MQSENDER) CCSID(1208)C:\Users\Joao>echo "123 ABC #$€" | amqsput QL1 MQSENDERSample AMQSPUT0 starttarget queue is QL1Sample AMQSPUT0 endC:\Users\Joao>amqsget QL1 MQSENDERSample AMQSGET0 startmessage <"123 ABC #$â
------------------------------
Joao Ramires
Original Message:
Sent: Fri February 09, 2024 05:28 AM
From: Francois Brandelik
Subject: CCSID Code pages CHCP and display Euro symbol €
To make sure you never loose any symbol in any language, you should set your codpage to UTF-8 and the CCSID of the qmgr to 1208.
Have fun.
------------------------------
Francois Brandelik
Original Message:
Sent: Thu February 08, 2024 10:17 AM
From: Joao Ramires
Subject: CCSID Code pages CHCP and display Euro symbol €
Hi!
This topic has always confused me and continues to do so... to display the euro symbol. In this example I have a DOS prompt (the box is Windows 7...) and a V9.0 queue manager.
I do, with the sample apps, a put, a browse and a get. In the put operation a € is written "123 ABC #$€" is the message. When I do the get, a "?" is returned instead "€" and my question is why this happens? What do I need to do, to do the get and display the € symbol?
Thanks!
C:\Users\Joao>chcpActive code page: 850C:\Users\Joao>echo dis qmgr ccsid | runmqsc MQSENDER5724-H72 (C) Copyright IBM Corp. 1994, 2018. 1 : dis qmgr ccsid QMNAME(MQSENDER) CCSID(850)C:\Users\Joao>echo "123 ABC #$€" | amqsput QL1 MQSENDERSample AMQSPUT0 starttarget queue is QL1Sample AMQSPUT0 endC:\Users\Joao>amqsbcg QL1 MQSENDERAMQSBCG0 - starts here********************** MQOPEN - 'QL1' MQGET of message number 1, CompCode:0 Reason:0****Message descriptor**** StrucId : 'MD ' Version : 2 Report : 0 MsgType : 8 Expiry : -1 Feedback : 0 Encoding : 546 CodedCharSetId : 850 Format : 'MQSTR ' Priority : 0 Persistence : 0 MsgId : X'414D51204D5153454E4445522020202017CDC4652596F506' CorrelId : X'000000000000000000000000000000000000000000000000' BackoutCount : 0 ReplyToQ : ' ' ReplyToQMgr : 'MQSENDER ' ** Identity Context UserIdentifier : 'Joao ' AccountingToken : X'16010515000000C7B63CC233C815FB94A77D3BE803000000000000000000000B' ApplIdentityData : ' ' ** Origin Context PutApplType : '11' PutApplName : ':\IBM\MQV8\bin64\amqsput.exe' PutDate : '20240208' PutTime : '14581561' ApplOriginData : ' ' GroupId : X'000000000000000000000000000000000000000000000000' MsgSeqNumber : '1' Offset : '0' MsgFlags : '0' OriginalLength : '-1'**** Message **** length - 14 of 14 bytes00000000: 2231 3233 2041 4243 2023 243F 2220 '"123 ABC #$?" ' No more messages MQCLOSE MQDISCC:\Users\Joao>amqsget QL1 MQSENDERSample AMQSGET0 startmessage <"123 ABC #$?" >
------------------------------
Joao Ramires
------------------------------