解码数字HTML实体 [英] decoding numeric HTML entities
本文介绍了解码数字HTML实体的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
大家好!
我需要一种方法将数字HTML实体(如Ü)解码回
他们的UTF-8字符将它们放入textarea。我尝试了下面的
,但它在IE中不起作用。
data = data.replace(/&#(\d +); / g,
function(){
返回String.fromCharCode(RegExp。$ 1);
});
有没有人有一个crossbrowser解决方案?
问候
Hi all!
I need a way to decode numeric HTML entities (like Ü) back to
their UTF-8 character to place them into a textarea. I tried the
following but it doesn''t work in IE.
data = data.replace(/&#(\d+);/g,
function() {
return String.fromCharCode(RegExp.$1);
});
Has anyone a crossbrowser solution?
Regards
推荐答案
1);
});
有没有人有一个crossbrowser解决方案?
问候
1);
});
Has anyone a crossbrowser solution?
Regards
Andreas Gohr写道:
Andreas Gohr wrote:
大家好!
我需要一种方法来解码数字HTML实体(如Ü)回到他们的UTF-8字符,将它们放入textarea。我试过
以下但它在IE中不起作用。
data = data.replace(/&#(\d +); / g,
功能(){
返回String.fromCharCode(RegExp。
Hi all!
I need a way to decode numeric HTML entities (like Ü) back to
their UTF-8 character to place them into a textarea. I tried the
following but it doesn''t work in IE.
data = data.replace(/&#(\d+);/g,
function() {
return String.fromCharCode(RegExp.
1);
});
尝试:
函数(fullmatch,parenmatch1){
返回String.fromCharCode(+ parenmatch1);
有没有人有一个crossbrowser解决方案?
关心
1);
}); try:
function(wholematch, parenmatch1) {
return String.fromCharCode(+parenmatch1);
}
Has anyone a crossbrowser solution?
Regards
这篇关于解码数字HTML实体的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文