Am trying to read data from DB and assign those data to a DataObject. But one of the column in DB has a invalid char(Please see highlighted text area in the image https://i.stack.imgur.com/6bpx4.png ) which is not able to get parse in XML UTF-8, can any one please help me in resolving it. Thanks in advance
At present am using following code to remove invalid characters
try {
out = new StringBuffer(); // Used to hold the output.
char current; // Used to reference the current character.
if (in == null || ("".equals(in))) return ""; // vacancy test.
for (int i = 0; i < in.length(); i++) {
current = in.charAt(i); // NOTE: No IndexOutOfBoundsException caught here; it should not happen.
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();