Posted By

emdin on 12/15/10


Tagged

utf-8


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

wirenaught


Decode encoded UTF-8 characters


 / Published in: JavaScript
 

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

  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  

You need to login to post a comment.