title: Replacing £ character from html textarea using javascript
body: <p>I'm currently developing a simple web app using html with JavaScript, and I'm trying to do a simple string.replace call on a string received from a html textarea like so;</p>
  
  <pre><code>var contents = document.getElementById("contents").value;
  var alteredText = contents.replace(/£/g, "poundsign");
  </code></pre>
  
  <p>The problem is that when a £ sign is included in the string, the replace call can't find it. I've looked at the code via the console and it seems that anytime there's a $ sign in JavaScript it adds a "Â" to the £ symbol, so</p>
  
  <pre><code>string.replace(/£/g, "poundsign");
  </code></pre>
  
  <p>as it was written in the js file becomes the following while running:</p>
  
  <pre><code>string.replace(/Â£/g, "poundsign");
  </code></pre>
  
  <p>while £ in var contents remains simply £ (putting Â£ into the textarea causes the replace call to work correctly). Is there a way to stop the Â being added in the js file, or to add it to the html file before .replace is called? </p>
  
  <p>The Â is added anytime £ appears in the js file as far as I can see, and I haven't been able to get it to match up with the html without the user adding the Â to the html themselves.</p>