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 ü .https://www.utf8-zeichentabelle.de/unicode-utf8-table.pl?names=-&unicodeinhtml=hex

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

https://blogs.sap.com/2015/02/22/handling-code-page-character-encoding-in-sap-pi-po/

https://blogs.sap.com/2014/10/09/character-encoding-handled-the-right-way/

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.

https://stackoverflow.com/questions/652161/how-do-i-convert-between-iso-8859-1-and-utf-8-in-java

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.

package com.java.special.chars; import java.io.BufferedReader;
import java.io.File;
import java.io.FileInputStream;
import java.io.InputStream;
import java.io.InputStreamReader;
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