Js function to convert accented characters to corresponding English alphabets

My last project required me to deal with accented characters. We needed to change these accented characters to normal english characters because the accented characters gets encoded while being passed through an URL.

The following code snippet shows how to change accented characters to their corresponding English alphabets.

function js_accent_translate(text)
{
    var str = text;
    var translated_text = str.replace(/[]/g,'A').replace(/[]/g,'C').replace(/[]/g,'D').replace(/[�]/g,'E'
    ).replace(/[]/g,'I').replace(/[�]/g,'L').replace(/[]/g,'N').replace(/[�]/g,'O').replace(/[]/g,'R'
    ).replace(/[©]/g,'S').replace(/[]/g,'T').replace(/[]/g,'U').replace(/[]/g,'Y')
    .replace(/[®]/g,'Z').replace(/[�]/g,'a').replace(/[]/g,'c').replace(/[]/g,'d')
    .replace(/[�]/g,'e').replace(/[]/g,'i').replace(/[�]/g,'l').replace(/[]/g,'n')
    .replace(/[�]/g,'o').replace(/[]/g,'r').replace(/[]/g,'s').replace(/[]/g,'t')
    .replace(/[]/g,'u').replace(/[]/g,'y').replace(/[]/g,'z');
    alert(translated_text);
}


Just call the above function through any js event with the accented character as the parameter to change  of the function as shown above.

Hope this small function helps while dealing with the accented characters.

150 150 Burnignorance | Where Minds Meet And Sparks Fly!