如何在IBM WebSphere MQ本地队列手动放入ISO-8859-2编码XML消息并解决乱码
Fixing ISO-8859-2 XML Message Garbled Characters in IBM MQ Explorer
I’ve run into similar MQ character set headaches before, especially with Eastern European encodings like ISO-8859-2. The root issue here is that MQ Explorer defaults to using your system’s native encoding (like Windows CP1252 or UTF-8) instead of ISO-8859-2 when converting your pasted XML into an MQ message. Here are two solid fixes to get those ő and ű characters through correctly:
Method 1: Force ISO-8859-2 via Message Properties in MQ Explorer
This lets you explicitly set the message’s character set before sending:
- Right-click your target queue and select Put Test Message
- Skip pasting your XML for now—click the Message Properties button (look for a gear icon or link in the dialog)
- In the properties panel, find the CCSID (Character Set ID) field and set it to 28592 (this is MQ’s standard CCSID for ISO-8859-2)
- Return to the message content box, paste your XML, and double-check it includes the correct encoding declaration at the top:
<?xml version="1.0" encoding="ISO-8859-2"?> <!-- Your full XML content here --> - Click Put Message to send it off
Method 2: Use the amqsput Command-Line Tool (More Reliable for Non-UTF-8 Encodings)
GUI tools often have hidden encoding conversions, so the native MQ command-line tool avoids this entirely:
- Open the IBM MQ Command Prompt (Windows) or a shell with MQ environment variables configured (Unix/Linux)
- Run this command to target your queue and queue manager:
amqsput YOUR_QUEUE_NAME YOUR_QUEUE_MANAGER_NAME - Set your terminal to use ISO-8859-2 first:
- On Windows: Run
chcp 28592to switch the console encoding - On Unix/Linux: Set your locale to an ISO-8859-2 variant, e.g.,
export LANG=hu_HU.iso88592
- On Windows: Run
- Paste your XML (with the correct
encoding="ISO-8859-2"declaration) into the terminal - Press Enter twice to send the message
Quick Checks to Prevent Repeat Issues
- Make sure your source XML file is saved in ISO-8859-2 encoding, not UTF-8. If you’re copying from a text editor, verify its save encoding settings.
- Confirm the receiving application is configured to process messages with CCSID 28592. Even if you send correctly, a mismatched app encoding will still cause garbled text.
内容的提问来源于stack exchange,提问作者Csaba Szekeres
相关产品推荐
相关产品推荐

