title: JAXB outputting invalid XML when data contains non-displayable chars
body: <p>I'm using JAXB 2.2.5 to output Xml from a JAXB Model, the data is populated from the database and occasionally the database contains non-displayable characters that it should not such as </p>
  
  <pre><code>0x1a 
  </code></pre>
  
  <p>If it does then JAXB outputs invalid Xml by just outputting this char as is, shouldn't it escape it or something ?</p>
  
  <p><strong>Update</strong></p>
  
  <p>I wonder if there are any implementations that do fix this problem, maybe Eclipselink MOXy does ?</p>
  
  <p><strong>EDIT</strong></p>
  
  <p>I tried the workaround that fixes the illegal char issue however it changes the output in an undesirable way. </p>
  
  <pre><code>&lt;?xml version="1.0" encoding="UTF-8" standalone="yes"?&gt;&lt;metadata created="2013-02-27T11:40:04.009Z" xmlns="http://musicbrainz.org/ns/mmd-2.0#" xmlns:ext="http://musicbrainz.org/ns/ext#-2.0"&gt;&lt;cdstub-list count="1" offset="0"&gt;&lt;cdstub id="w237dKURKperVfmckD5b_xo8BO8-" ext:score="100"&gt;&lt;title&gt;fred&lt;/title&gt;&lt;artist&gt;&lt;/artist&gt;&lt;track-list count="5"/&gt;&lt;/cdstub&gt;&lt;/cdstub-list&gt;&lt;/metadata&gt;
  </code></pre>
  
  <p>to </p>
  
  <pre><code>&lt;?xml version="1.0" ?&gt;&lt;metadata xmlns:ext="http://musicbrainz.org/ns/ext#-2.0" xmlns="http://musicbrainz.org/ns/mmd-2.0#" created="2013-02-27T11:39:15.394Z"&gt;&lt;cdstub-list count="1" offset="0"&gt;&lt;cdstub id="w237dKURKperVfmckD5b_xo8BO8-" ext:score="100"&gt;&lt;title&gt;fred&lt;/title&gt;&lt;artist&gt;&lt;/artist&gt;&lt;track-list count="5"&gt;&lt;/track-list&gt;&lt;/cdstub&gt;&lt;/cdstub-list&gt;&lt;/metadata&gt;
  </code></pre>
  
  <p>i.e <code>&lt;track-list count="5"/&gt;</code> has become <code>&lt;track-list count="5"&gt;&lt;/track-list&gt;</code>which is undesirable, I'm not sure why it is doing this.</p>