I am sending a string from .net service to java class but in java , I am getting org.xml.sax.SAXParseException: Character reference "�" is an invalid XML character.
Please help me in solving this. Thanks in advance.
I am sending a string from .net service to java class but in java , I am getting org.xml.sax.SAXParseException: Character reference "�" is an invalid XML character.
Please help me in solving this. Thanks in advance.
In C or C++ strings are terminated by the null (or '\0'). In C# a string can contain a null, but often these come from a C/C++ function.
You can get rid of the null in the .net String with
s = s.Replace("\0", ""); // just removes the null
or
int pos = s.IndexOf('\0');
if (pos >= 0)
s = s.Substring(0, pos); // removes the null and the rest of the string
depending on what is the reason for the null in the string.