Skip to Content
Technical Articles
Author's profile photo Muni M

JMS special characters Issue

Recently I have worked in JMS(MQ) to Proxy scenario, in which I was facing special characters issue. Basically all umlaut chars such as ä,ö,ü are not displayed correct. I was not using any mapping as this is a pass through scenario.



When I download the file into my local machine and open with browser, still same issue exists.

Tried to open with notepad++ and changed encode to ANSI, now chars are displayed correct, saved the file and opened again with browser, now char is getting displayed correctly.





then checking hex code of ü in notepad++. with utf-8


changing encoding to ANSI.

Changing the file encoding to ANSI, creates correct HEX code.


c3 bc is the correct hex code for char ü .


I have tried all adapter module beans, as mentioned in below blogs.

I have tried TextCodepageConversionBean also, which did not work. It could be due to that this is meant for text file not xml file.


Then I have seen this code in stack overflow, This is exactly what is happening in my case.


String encodedWithISO88591 = "üzüm baÄları";
String decodedToUTF8 = new String(encodedWithISO88591.getBytes("ISO-8859-1"), "UTF-8");
//Result, decodedToUTF8 --> "üzüm bağları"


I have tried to convert my downloaded xml using java code and it worked fine. I did not convert the encoding, just download the file from monitor and used it in the java code.



import java.nio.charset.Charset;
import java.nio.charset.StandardCharsets;

public class Readfile {

	public static void main(String[] args) throws Exception{
		// TODO Auto-generated method stub
		InputStream is = new FileInputStream("data/esm.xml");
		BufferedReader reader = new BufferedReader(new InputStreamReader(is,StandardCharsets.UTF_8));
		StringBuilder out = new StringBuilder();
		String line;
		while ((line = reader.readLine()) != null) {
			byte[] b = line.getBytes(StandardCharsets.ISO_8859_1);
			System.out.println(new String(b, StandardCharsets.UTF_8));





Now the question is, how to achieve the same using module configuration instead of writing java map.

Since my payload is an xml, I had to use anonymizer bean with Message Transform bean. This has solved the issue, chars are getting displayed correct now.



Xml payload


Assigned Tags

      1 Comment
      You must be Logged on to comment or reply to a post.
      Author's profile photo Daniel Graversen
      Daniel Graversen

      By fair one of the challenges that you often face when working with integration, is that people use different character sets. Good standard solution you ended up with.