Home > Mobile >  What encoding is this character? And how to handle it in xml
What encoding is this character? And how to handle it in xml

Time:11-03

<tac id="10" name="KD&#11;#36">

I have a program that saves in xml (using Java). But after saving this line, the xml cannot be loaded anymore (SAX Parser). Do I need to change the xml header to something else than UTF-8, if yes, to what?

CodePudding user response:

The numeric character reference &#11;is illegal in XML 1.0, but it is allowed in XML 1.1. Java's SAX parser should be able to parse XML 1.1, but this requires that the XML declaration at the top of the document specifies version 1.1:

<?xml version="1.1"?>

CodePudding user response:

Okay I figured it out.

Its "KD" plus the ASCII control character VTAB plus "#36".

Apparently Java cannot properly write that char to xml, so I just use regex to replace it with something else before writing to xml.

  • Related