cancel
Showing results for 
Search instead for 
Did you mean: 

UTF-8 BOM encoding in SCPI doesn't work

psethi
Discoverer
0 Kudos

Hi Experts,

I am intgerating SuccessFactors with Concur and they want UTF-8 with BOM. I have tried several scripts that's mentioned in below blog along with some changes as well but nothing really works. Do you know if it's still possible to enforce BOM?

https://answers.sap.com/questions/52480/hci-adding-byte-order-mark-bom-to-utf-8-file-conte.html

Concur needs a text file so after converting it to file, I am setting CamelCharsetName as UTF-8 before the script.

I am using below script :

import com.sap.it.api.mapping.*;

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

import java.util.HashMap;

import java.nio.charset.StandardCharsets;

def Message processData(Message message) {

Map headerMap = message.getHeaders();

def payload = message.getBody(java.lang.String) as String;

byte[] bom = [0xEF,0xBB,0xBF];

byte[] document = payload.getBytes(StandardCharsets.UTF_8);

byte[] withBom = new byte[bom.length + document.length];

System.arraycopy(bom,0,withBom,0,bom.length);

System.arraycopy(document,0,withBom,bom.length,document.length);

String s2 = new String(withBom); message.setBody(s2);

return message;

}

I can see some special characters being populated but when I open the file in notepad++ it still shows encoding as UTF-8. Could you please help?

Cheers,

Pratibha

former_member649396
Discoverer
0 Kudos

Hi Pratibha,

Are you able to achieve this ?

Thanks

Rajat

former_member32396
Discoverer
0 Kudos

Hi Pratibha/Rajat,

Were you able to achieve this?

Thanks.

Accepted Solutions (0)

Answers (0)