cancel
Showing results for 
Search instead for 
Did you mean: 
Subscribe

Does anyone have a JavaScript that they use in IDM that will take in a string and replace all accented characters with their non-accented equivalents? I've found a few online in non-IDM forums, like Stack Overflow or GitHub, that claim to work but when I plug them into IDM, they don't work.

If anyone has such a script that they use and know will work in IDM, I'd appreciate the knowledge transfer.

View Entire Topic
Former Member
Check this once.

// Main function:Z_removeAccent


function Z_removeAccent(Par) {


    var map = {
        'a': 'á|à|ã|â|À|Á|Ã|Â',
        'e': 'é|è|ê|É|È|Ê',
        'i': 'í|ì|î|Í|Ì|Î',
        'o': 'ó|ò|ô|õ|Ó|Ò|Ô|Õ',
        'u': 'ú|ù|û|ü|Ú|Ù|Û|Ü',
        'c': 'ç|Ç',
        'n': 'ñ|Ñ'
    };


    str = Par;


    for (var pattern in map) {
        str = str.replace(new RegExp(map[pattern], 'g'), pattern);
    }


    return str;
}