1

I had a problem with some illegal xml characters being submitted from a form. I was. Some user had cop pasted a Vertical tab into the form and submitted it. When I copied this out of the database it would show like this(in notepad++)

enter image description here

I cleaned this with this method

function cleanXmlChars(input) {
    var NOT_SAFE_IN_XML_1_0 = /[^\x09\x0A\x0D\x20-\xFF\x85\xA0-\uD7FF\uE000-\uFDCF\uFDE0-\uFFFD]/gm;
    return input.replace(NOT_SAFE_IN_XML_1_0, '');
};

Thanks to Removing invalid characters from XML before serializing it with XMLSerializer()

I thought I was ll done but then I tried holding down Alt + 11 and i found out that this character was not removed

Aint this the same illegal character? Wont this cause the same trouble if typed in?

Community
  • 1
  • 1
Jepzen
  • 2,942
  • 6
  • 40
  • 62

0 Answers0