cancel
Showing results for 
Search instead for 
Did you mean: 

Handle special characters using UDF

Former Member
0 Kudos

Hello All,

I have replace the below given special characters with diffrent strings using UDF.

Can someone please help me to do that. I am not very good at java.

Symbol change to

u2122 *T

® *R

° *D

Thanks,

Accepted Solutions (0)

Answers (2)

Answers (2)

Former Member
0 Kudos

Solved

Former Member
0 Kudos

Hi,

Use this below code for the special characters; Instead of & you can place what ever you have the special characters.

Along with below code you have to use "aii_map_api" library also. This library is available in the Net.

package common.xi;

import java.io.InputStream;

import java.io.OutputStream;

import java.util.Map;

import com.sap.aii.mapping.api.StreamTransformation;

import com.sap.aii.mapping.api.StreamTransformationException;

public class HandleAmpersand implements StreamTransformation {

public void setParameter(Map arg0) {

}

public void execute(InputStream in, OutputStream out) {

try {

int read_data;

while ((read_data = in.read())!=-1)

{

if (read_data != '&')

out.write(read_data);

else

out.write("&".getBytes());

}

out.flush();

} catch (Exception e) {

}

}

}

Regards

Ramesh

Former Member
0 Kudos

Can you please help me to write simple UDF.

I am able to handle the single special charcter using the below code

{

b = a.replaceAll("®", "*R");

}

But how do i check for all the special characters and send the string.

Thanks

stefan_grube
Active Contributor
0 Kudos

> Use this below code for the special characters; Instead of & you can place what ever you have the special characters.

That won't work as the above mentioned characters are 2-byte characters in UTF-8