Skip to Content
0
Jun 17, 2021 at 07:17 AM

How to decode UTF-16LE in SAP CPI

204 Views Last edit Jun 17, 2021 at 03:22 PM 3 rev

Hi All,

we have a requirement to Fetch encoded csv file from sender SFTP Server and need to decode characters UTF-16LE in to UTF-8.

I have tried below Groovy script.

Input:

import com.sap.gateway.ip.core.customdev.util.Message

import java.nio.charset.StandardCharsets

import java.nio.charset.Charset

def Message processData(Message message) {

def body = message.getBody(java.lang.String);

message.setBody(body.getBytes("UTF-8"));

return message

}

output:

1 0 2 4 5 7 9 , B e l g i u m , c o r p o r a t e

1 6 4 2 8 1 3 , E u r o p e, c o r p o r a t e

3 5 2 6 8 3 1 , I t a l y , i n d u s t r y

https://answers.sap.com/questions/13416178/how-to-decode-utf-16le-in-sap-cpi.html

https://answers.sap.com/questions/13416178/how-to-decode-utf-16le-in-sap-cpi.html

output of the data is coming with unwanted spaces and symbols.

could anyone please suggest with right solution.

Regards

Ashok

Attachments

brsz8.png (13.0 kB)
6v9mp.png (13.6 kB)
jx5e8.png (13.0 kB)
pdb21.png (13.6 kB)
8bcay.png (13.0 kB)
szqdj.png (13.6 kB)