Skip to Content
0
Jul 23, 2010 at 11:39 AM

How to Handle Special Characters in PI7.1

111 Views

Hi Team,

I need to handle some special characters like <,>,& etc.. from WS Adapter to CRM in PI 7.1.

http://www.sdn.sap.com/irj/scn/weblogs?blog=/pub/wlg/9420 [original link is broken]

By using the above blog i had implemented the Java Code as

public void execute(InputStream in, OutputStream out){

try{

int read_data;

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

if (read_data == '&'){

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

}else if (read_data == '>'){

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

}else if (read_data == '<'){

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

}else if (read_data == '/'){

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

}else if (read_data == '\''){

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

}

else { out.write(read_data);

}

}

out.flush();

} catch (Exception e){}

}

I had added this class file in Operational Mapping.

It is working if we have only one IF condition for & in while

Any suggestion

Thanks

Sriram