I have a website which apperently removes the correct encoding (ISO-8859-1) from a string and sends it wrong.
I have this encoding specified in my HTML
Because I had the same problem, I'll provide a solution that worked for me. Background: Microsoft Excel is too stupid to export a CSV-File in charset UTF-8:
$.ajax({
url: '...',
contentType: 'Content-type: text/plain; charset=iso-8859-1',
// This is the imporant part!!!
beforeSend: function(jqXHR) {
jqXHR.overrideMimeType('text/html;charset=iso-8859-1');
}
});
According to the jQuery.ajax() contentType documentation:
Data will always be transmitted to the server using UTF-8 charset; you must decode this appropriately on the server side."