javascript - Value &# to unicode convert -


i have lots of characters in form ¶ display unicode characters in text editor. ought convert them:

var newtext = doctext.replace(     /&#(\d+);/g,      string.fromcharcode(parseint("$1", 10)) ); 

but doesn't seem work. regular expression /&#(\d+);/ getting me numbers out -- string.fromcharcode not appear give results i'd like. up?

the replacement part should anonymous function instead of expression:

var newtext = doctext.replace(     /&#(\d+);/g,      function($0, $1) {         return string.fromcharcode(parseint($1, 10));     } ); 

Comments

Popular posts from this blog

iphone - Three second countdown in cocos2d -

hyperlink - how to do url routing in php -

c - Avoiding Extra Malloc in Linked List (node->next = NULL) -