Get hands-on experience with 20+ free Google Cloud products and $300 in free credit for new customers.

Java callout | message content with non-ASCII characters

Hi,
I have non-ASCII chars in the body request [Hebrew chars] like: {"address": "תמוז"}
Using the following Java code I can see: {"address": "????"}

package com.apigee.flow.message;
message.getContent()

But in the Debug tracing. I can see the correct chars in the Body.
Can you please advise? how to handle the content to support non-ASCII characters?
tchelets_0-1716791766006.png

 

3 1 158
1 REPLY 1

Using the following Java code I can see: {"address": "????"}

How are you "seeing" that?

The call to message.getContent() should return the message decoded according to the character set specified in the content-type of the header.

Content-Type: text/html; charset=utf-8

If the content-type says "US-ASCII" then you will get question marks (not able to decode). If there is no charset specified then it should default to UTF-8, which will support Hebrew characters.

Is it possible that message.getContent() is working correctly and then when you "see" the content, it is not being serialized correctly?

 

Top Solution Authors