我有这个法语字符串:
Veuillez indiquer vos spécialités
我希望在我的 JS Alert 中这样:
Veuillez indiquer vos spécialités
这是我的代码:
$(function(){
alert('Veuillez indiquer vos spécialités');
});
最佳答案
由于您使用的是 jQuery:
$(function(){
var frenchy = 'Veuillez indiquer vos spécialités';
alert( $('<div />').html( frenchy ).text() );
// If performance is an issue, you can change the dom creation of the div:
// alert( $(document.createElement('div')).html( frenchy ).text() );
});
还有jsFiddle Demo 。和this answer explains为什么后者更快:)
关于javascript - 在 Javascript 中将 é 转换为其原始形式,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20238920/