How to change UTF-8 to UTF-16 in assign message for xml response

Not applicable

I am receiving json response from backend and converting to xml response using Json To Xml policy,I a m getting response as below.

<?xml version="1.0" encoding="UTF-8"?><Response>

But I need to change to encoding="UTF-16"?

I tried to add below in assign message policy, but dint work.

<Payload contentType="text/xml; charset=utf-16">

Anyone pls help.

0 2 1,313
2 REPLIES 2

Hi - can you explain why you need that?

There is a client that requires a specific encoding?

Please elaborate.

Not applicable

We had a similar situation where we had to convert from ISO to UTF-8. We used a Java Callout to achieve it. Here is a small snippet for the same:

byte[] targetByteArr = null;

targetByteArr = new String(inputContent.getBytes(), sourceEncoding).getBytes(targetEncoding); outputContent = new String(targetByteArr, targetEncoding);

,

We had a similar situation where we need to convert from ISO to UTF-8. We ended up using a Java callout to achive the same. Here is a small snippet :

byte[] targetByteArr = null;

targetByteArr = new String(inputContent.getBytes(), sourceEncoding).getBytes(targetEncoding); outputContent = new String(targetByteArr, targetEncoding);