Displaying accented character in Javascript

妖精的绣舞 提交于 2019-12-09 03:17:26
clintgh

To give more detail to @georg 's advice that helped me solve this issue:

Since I can't change the server side scripts, I adjusted the code on my side.
I changed the charset in my ajax request to ISO-8859-1, but since the default charset of ajax is utf-8, I had to override the charset with $.ajax.beforeSend:

$.ajax({
    url: url,
    type: "GET",
    dataType: "json",
    contentType: "application/json; charset=iso-8859-1",
    success: function(uri){
         alert("clintg test: " + JSON.stringify(uri));
    },
    beforeSend: function(jqXHR) {
        jqXHR.overrideMimeType('application/json;charset=iso-8859-1');
    }
}

Here's a link to the question that helped me figure out and override the charset: Jquery ignores encoding ISO-8859-1

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!