Decode encoded UTF-8 characters


/ Published in: JavaScript
Save to your folder(s)

This code converts decode encoded UTF-8 characters. So á will be converted back to á ("a with acute").


Copy this code and paste it in your HTML
  1. var text;
  2.  
  3. if (text.match(/\&[^;]+\;/gi,text) && document) {
  4. var div = document.createElement('div');
  5. div.innerHTML = text.replace(/\&amp\;/gi,'&');
  6. text = div.innerHTML;
  7. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.