JSON result of .ajax() is UTF8 but not always seen as UTF8 ?!?
Hello,
I have an ajax function that receives form data serialized and returns a JSON object. The odd thing is that sometimes the answer is correctly seen as UTF-8 but most of the times, it is seen as something else (latin1 ?) and I don't see "Ce nom est déjà pris" but "Ce nom est déjà pris" (UTF-8 re-encoding).
The ajax function is called like this :
- $.ajax({
- url: "/ajax/validateUserForm.html",
- dataType: "json",
- data: $("form#userform").serialize(),
- contentType: "charset=utf-8",// useless
- type: "POST"
- }).done( function(result) {
-
- $.each(result, function(key, val) {
- console.info(key+' : '+val);
- });
- });
Server side, I checked the result sent back is (always) UTF8.
Firebug tells me the response always has :
- Content-Type
: text/html; charset=utf-8
Any clue ?
Thanks for your help.