title: How to write correct xml for special characters
body: <p>I'm trying to write correct svg from string  which uses special characters.I'm using UTF-8 encoding for svg document.I'm working on javascript .
  The string is like :</p>
  
  <pre><code>&lt;glyph unicode="&amp;#xa5;" horiz-adv-x="819" /&gt;
  </code></pre>
  
  <p>While writing xml using DOMParser api , it converts &#xa5; into ¥ which is incorrect xml and browser throws XML Parsing error .</p>
  
  <p>Here is the complete text which I want to convert into SVG document .</p>
  
  <pre><code>&lt;?xml version="1.0" standalone="no"?&gt;
  &lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" &gt;
  &lt;svg xmlns="http://www.w3.org/2000/svg"&gt;
  &lt;metadata&gt;&lt;/metadata&gt;
    &lt;defs&gt;
      &lt;font id="DearestRegular" horiz-adv-x="2048" &gt;
        &lt;font-face units-per-em="2048" ascent="1638" descent="-410" /&gt;
        &lt;glyph unicode="&amp;#xa5;" horiz-adv-x="819" /&gt;
      &lt;/font&gt;
   &lt;/defs&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>Using DOMParser I'm getting the output like :</p>
  
  <pre><code>&lt;?xml version="1.0" standalone="no"?&gt;
  &lt;!DOCTYPE svg PUBLIC "-//W3C//DTD SVG 1.1//EN"   "http://www.w3.org/Graphics/SVG/1.1/DTD/svg11.dtd" &gt;
  &lt;svg xmlns="http://www.w3.org/2000/svg"&gt;
  &lt;metadata&gt;&lt;/metadata&gt;
    &lt;defs&gt;
      &lt;font id="DearestRegular" horiz-adv-x="2048" &gt;
        &lt;font-face units-per-em="2048" ascent="1638" descent="-410" /&gt;
        &lt;glyph unicode="¥" horiz-adv-x="819" /&gt;
      &lt;/font&gt;
   &lt;/defs&gt;
  &lt;/svg&gt;
  </code></pre>
  
  <p>This throws XML Parsing error in browser .</p>