title: replace all weird characters in xml to its equivalent 'character reference'
body: <p>I have an XML which has some characters like,</p>
  
  <pre><code>&amp;pound; &amp;deg;                   /* entity reference aka symbolic character ref */
  » &amp; Â • ›                       /* unicode characters */
  </code></pre>
  
  <p>I want to replace both such characters (entity ref &amp; unicode chars) with their "character references" aka "numeric character ref",</p>
  
  <pre><code> &amp;#163;  - character reference for '&amp;pound;' OR '£'
  </code></pre>
  
  <p>How do I implement this? Is there a php function which does this? </p>
  
  <p>Thanks!</p>