How do I remove accentuated characters from a string? Especially in IE6, I had something like this:
accentsTidy = function(s){
var r=s.toLowerCase();
Shortened code based on the excellent solution by Ian Elliott:
accentsTidy = function(s){
var r = s.toLowerCase();
non_asciis = {'a': '[àáâãäå]', 'ae': 'æ', 'c': 'ç', 'e': '[èéêë]', 'i': '[ìíîï]', 'n': 'ñ', 'o': '[òóôõö]', 'oe': 'œ', 'u': '[ùúûűü]', 'y': '[ýÿ]'};
for (i in non_asciis) { r = r.replace(new RegExp(non_asciis[i], 'g'), i); }
return r;
};
Edit: Corrected non-working code