cancel
Showing results for 
Search instead for 
Did you mean: 

Handling unicode characters in PI

Former Member
0 Kudos

Hi Experts,

It's a file to proxy scenario. Sometimes the input file has some special characters, hence it's leading to the error 'An invalid XML character (Unicode: 0x13) was found in the element content of the document'.  It occurs at the mapping runtime.
I've tried saving the input file encoding as ANSI/UNICODE/UTF-8. But in all cases i'm gettting the above error.
Any idea to overcome this issue? Thanks in advance!


Regards,
Senthil J

Accepted Solutions (0)

Answers (4)

Answers (4)

Former Member
0 Kudos

Hi All,

In the above sceanrio the sender is SFTP channel. I'm using messageTransfromBean for the content coversion. Now i want to avoid/skip that field(which is having the unicode character) in the adapter level. Is there any parameter in messageTransformBean will help for this?

Thanks in advance!

Regards,

Senthil J

Former Member
0 Kudos

Hi Senthil

Also by writing the java code below you can ignore the unicode characters from file

public String stripNonValidXMLCharacters(String in) {

StringBuffer out = new StringBuffer();
char current;

if (in == null || ("".equals(in))) return "";

for (int i = 0; i < in.length(); i++) {

current = in.charAt(i);

if ((current == 0x9) || (current == 0xA) || (current == 0xD) ||((current >= 0x20) && (current <= 0xD7FF)) ||((current >= 0xE000) && (current <= 0xFFFD)) || ((current >= 0x10000) && (current <= 0x10FFFF)))

out.append(current);

}       
return out.toString();

}

But the best solution will be correcting your sending system so that it will not send the unicode characters.

Former Member
0 Kudos

Hi Senthil

Try File Encoding with ISO-8859-1 or UTF-16 and see if it works or not.

javier_alcubilla
Contributor
0 Kudos

Hi Senthil

In the sender file adapter you can find the file encoding field under Processing tab. Select File Type = Text and appears the option

Regards

Javi