Created
July 25, 2012 12:54
-
-
Save mdread/3176035 to your computer and use it in GitHub Desktop.
unescape characters encoded in the form "඀"
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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