I have a javascript file linked externally.
And inside that javascript, I have this function:
function getMonthNumber(monthName){
monthName = monthName.toLowerCase();
if(monthName == 'janvier'){
return "01";
}else if(monthName == 'février'){
return "02";
}else if(monthName == 'mars'){
return "03";
}else if(monthName == 'avril'){
return "04";
}else if(monthName == 'mai'){
return "05";
}else if(monthName == 'juin'){
return "06";
}else if(monthName == 'juillet'){
return "07";
}else if(monthName == 'août'){
return "08";
}else if(monthName == 'septembre'){
return "09";
}else if(monthName == 'octobre'){
return "10";
}else if(monthName == 'novembre'){
return "11";
}else if(monthName == 'décembre'){
return "12";
}
}
But, when I read it in Firebug, I see:
function getMonthNumber(monthName){
monthName = monthName.toLowerCase();
if(monthName == 'janvier'){
return "01";
}else if(monthName == 'février'){
return "02";
}else if(monthName == 'mars'){
return "03";
}else if(monthName == 'avril'){
return "04";
}else if(monthName == 'mai'){
return "05";
}else if(monthName == 'juin'){
return "06";
}else if(monthName == 'juillet'){
return "07";
}else if(monthName == 'août'){
return "08";
}else if(monthName == 'septembre'){
return "09";
}else if(monthName == 'octobre'){
return "10";
}else if(monthName == 'novembre'){
return "11";
}else if(monthName == 'décembre'){
return "12";
}
}
So that, basically all the accents were encoded.
As far as I found on the net, passing the charset to the script should fix that, but even though I tried passing charset="utf8" or charset="ISO-8859-1", none seems to work.
I’m not sure how to fix that. Any ideas?
As stated by JKirchartz and Šime Vidas, the answer was to make sure to save the file in the right charset.
Basically, dreamweaver was not saving it the good charset, but Eclipse does.
So I removed the charset attribute on the script and just saved it in the good charset and now it works.