Solving Special Character Issue while sending data to Receiver System using HTTP Adapter
While sending data to target system using HTTP adapter, all the special characters in the data turns into “?”.Languages like Hebrew, Turkish, Russian contains special characters and these data after sending to target system with HTTP receiver channel gets corrupted and does not reflect as expected. Reason behind this is the HTTP receiver adapter needs a byte array and uses the defined charset for the encoding (or ASCII if nothing is defined). Characters that do not exist in the used encoding are replaced by “?” signs.
Let’s follow some simple steps to overcome this issue:
We will define the required encoding in Content Modifier step. Add a new property in Exchange Property as below:
Action Name Type Value
Create CamelCharsetName Constant UTF-8
While providing payload in JSON structure, we provide in the below way:
Now, the issue is Hebrew most of the times contains a (“) Double Quote in between strings.
Example : **עובד כ”א זמני**–Here is one ” in between string. While sending payload in JSON structure this ” creates an issue. Because JSON payload always come in between a “<string>”.
Here, CPI accepts this as a double quote in between the JSON payload string that does not have an ending double quote. So, we need to escape this double quote. We will try to escape this using a Groovy Script.
Please find the Sample escape sequence in below code snippet:
The replaceAll() function escapes all the double quotes in strings and shapes the payload in a good structure.
By taking care of these simple steps we can avoid data corruption in target systems while using HTTP receiver channel.
I found this KBA very helpful.