title: Replace HTML entities (e.g. &#8217;) with character equivalents when parsing an XML feed
body: <p>When parsing an XML feed, I am getting text from the content tag, like this:</p>
  
  <blockquote>
    <p>The Government has awarded funding for a major refurbishment project to go ahead at St Eunan&#8217;s College. This is in addition to last month&#8217;s announcement that grant for its prefabs to be replaced with permanent accomodation. The latest grant will allow for major refurbishment to a section of the school to allow for new accommodation for classes &#8211; the project will also involve roof repairs, the installation of a dust extraction system, new science room fittings and installation of firm alarms. Donegal Deputy Joe McHugh says credit must go to the school&#8217;s board of management</p>
  </blockquote>
  
  <p>Is there anyway to easily replace these special characters (i.e., HTML entities) for e.g., apostrophes, etc. with their character equivalents?</p>
  
  <p>EDIT:</p>
  
  <pre><code>Ti.API.info("is this real------------"+win.dataToPass)
  </code></pre>
  
  <p><br />
  returns: (line breaks added for clarity)</p>
  
  <pre><code>[INFO][TiAPI   ( 5437)]  Is this real------------------Police in Strabane are
  warning home owners and car owners in the town to be vigilant following a recent
  spate of break-ins. There has been a number of thefts from gardens and vehicles
  in the Jefferson Court and Carricklynn Avenue area of the town. The PSNI have
  said that residents have reported seeing a dark haired male in and around the
  area in the early hours of the morning. Local Cllr Karina Carlin has been
  monitoring the situation &amp;#8211; she says the problem seems to be getting
  worse&amp;#8230;&amp;#8230;.
  </code></pre>
  
  <p><br />
  My external.js file is below i.e. the one which merely displays the text above:</p>
  
  <pre><code>var win= Titanium.UI.currentWindow;
  
  Ti.API.info("Is this real------------------"+ win.dataToPass);
  
  var escapeChars = { lt: '&lt;', gt: '&gt;', quot: '"', apos: "'", amp: '&amp;' };
  
  function unescapeHTML(str) {//modified from underscore.string and string.js
      return str.replace(/\&amp;([^;]+);/g, function(entity, entityCode) {
          var match;
  
          if ( entityCode in escapeChars) {
              return escapeChars[entityCode];
          } else if ( match = entityCode.match(/^#x([\da-fA-F]+)$/)) {
              return String.fromCharCode(parseInt(match[1], 16));
          } else if ( match = entityCode.match(/^#(\d+)$/)) {
              return String.fromCharCode(~~match[1]);
          } else {
              return entity;
          }
      });
  }
  
  var newText= unescapeHTML(win.datatoPass);
  
  
  var label= Titanium.UI.createLabel({
      color: "black",
      //text: win.dataToPass,//this works!
      text:newText,//this is causing an error
      font: "Helvetica",
      fontSize: 50,
      width: "auto",
      height: "auto",
      textAlign: "center"
  })
  
  win.add(label);
  </code></pre>