javascript function to remove diacritics

后端 未结 3 1416
攒了一身酷
攒了一身酷 2020-12-18 00:45

I\'m searching for javascript function to replace French diacritics and came accross this code:

String.prototype.removeDiacritics = function() {
var diacriti         


        
3条回答
  •  Happy的楠姐
    2020-12-18 01:14

    Those three digit numbers are in octal, so if you take the unicode value of ÿ and convert it to octal, which is 377, you will be able to add it to the list:

    var diacritics = [
        // Your other values...
        [/[\377]/g, 'y'], 
        // ...
    ];
    

    Here is a good site to look up the octal values of characters:

    octal values of characters

提交回复
热议问题