Skip to content

Instantly share code, notes, and snippets.

@mdread
Created July 25, 2012 12:54
Show Gist options
  • Save mdread/3176035 to your computer and use it in GitHub Desktop.
Save mdread/3176035 to your computer and use it in GitHub Desktop.
unescape characters encoded in the form "඀"
function unescapeSpecialChars(str){
var result = str;
var pattern = /\&#\d{1,4};/g;
var arrMatch = null;
while (arrMatch = pattern.exec( str )){
result = result.replace(arrMatch[0], String.fromCharCode(/\&#(\d{1,4});/.exec(arrMatch[0])[1]));
}
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment