I want to use Evan Elliott\'s code (below) to remove accents in strings but its returns an \"a\" instead of the respective vanilla version of each character. I declare
This function may be useful for what you need:
function removeAccents (text) {
var accents = 'ÀÁÂÃÄÅàáâãäåÒÓÔÕÕÖØòóôõöøÈÉÊËèéêëðÇçÐÌÍÎÏìíîïÙÚÛÜùúûüÑñŠšŸÿýŽž',
accentsOut = "AAAAAAaaaaaaOOOOOOOooooooEEEEeeeeeCcDIIIIiiiiUUUUuuuuNnSsYyyZz",
textNoAccents = [];
for (var i in text) {
var idx = accents.indexOf(text[i]);
if (idx != -1)
textNoAccents[i] = accentsOut.substr(idx, 1);
else
textNoAccents[i] = text[i];
}
return textNoAccents.join('');
}