最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

jquery - Convert é to its orignal form in Javascript - Stack Overflow

programmeradmin0浏览0评论

I have this French string:

Veuillez indiquer vos spécialités

I want it like this in my JS Alert:

Veuillez indiquer vos spécialités

Here is my code:

$(function(){
    alert('Veuillez indiquer vos spécialités');
});

Fiddle here : /

I have this French string:

Veuillez indiquer vos spécialités

I want it like this in my JS Alert:

Veuillez indiquer vos spécialités

Here is my code:

$(function(){
    alert('Veuillez indiquer vos spécialités');
});

Fiddle here : http://jsfiddle/M6rLL/

Share Improve this question edited Nov 27, 2013 at 10:03 Martijn 16.2k4 gold badges38 silver badges72 bronze badges asked Nov 27, 2013 at 9:46 Hassan SardarHassan Sardar 4,52317 gold badges61 silver badges92 bronze badges 2
  • 2 alert('Veuillez indiquer vos sp\351cialit\351s'); – krasu Commented Nov 27, 2013 at 9:50
  • PHPJS's html_entity_decode – h2ooooooo Commented Nov 27, 2013 at 9:51
Add a ment  | 

1 Answer 1

Reset to default 6

Since you are using 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() );
});

And the jsFiddle Demo. And this answer explains why the latter is faster :)

发布评论

评论列表(0)

  1. 暂无评论