Can't convert special characters while parsing the XML

View: New views
1 Messages — Rating Filter:   Alert me  

Can't convert special characters while parsing the XML

by cha :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hi All,

Hope you can help me out with this one.

I am processing some input which am getting from mainframes which are in ascii as well as non ascii character. I have wrote the function as below to replace the characters..


private String Ebc2Asc ()
{
      return inStr.replace('^', '¬').replace('Ø', '^').replace('|', '¦').replace('!', '|').replace('[', '¢').replace(']', '!').replace('â', '[').replace('ã', ']');
}

Everything is working fine apart from characters such as â, Ø,ã etc.

Am getting problem is while building the XML it don't read the file properly because of presence of special characterrs in it such as â, Ø,ã etc. The error is "invalid xml."

I googled the net and try to use the encoding as -Dfile.encoding=ISO-8859-1 to overcome the issue but in vain.

Am using JDOM.

Please pass me your thoughts on this to overcome this issue.

Thanks,
Cha