cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Hello Experts,

I am using Base64 encoding to encode the xml message and send it to a single field. The encoding is unable to handle the special characters(ex. characters of Spanish language). The message gets encoded but the special character is converted to some junk value.

Is there any way to handle this? Below is the UDF code being used:

BASE64Encoder encoder = new BASE64Encoder();

String encoded = encoder.encode(payload.getBytes());

encoded = encoded.replace("\n","").replace("\r", "");

return encoded;

Kindly advice changes in code if required.

Thanks in advance!

Pankaj

0 Likes
View Entire Topic
manoj_khavatkopp
Active Contributor

Try with mentioning the encoding in the getBytes method:

Ex: encoder.encode(payload.getBytes("UTF-8"));

And also instead if using SUN's Base64 class use the default SAP provide a class to encode.

Former Member
0 Likes

Hi Manoj,

Received below error when above code used:

error: unreported exception UnsupportedEncodingException; must be caught or declared to be thrown
String encoded = encoder.encode(payload.getBytes("UTF-8"));

Thanks,

Pankaj