Dealing with ISO-encoding in AJAX requests (prototype)
        Posted  
        
            by acme
        on Stack Overflow
        
        See other posts from Stack Overflow
        
            or by acme
        
        
        
        Published on 2010-04-29T14:27:14Z
        Indexed on 
            2010/04/29
            15:07 UTC
        
        
        Read the original article
        Hit count: 443
        
I have a HTML-page, that's encoded in ISO-8859-1 and a Prototype-AJAX call that's build like this:
new Ajax.Request('api.jsp', {
    method: 'get',
    parameters: {...},
    onSuccess: function(transport) {
        var ajaxResponse = transport.responseJSON;
        alert(ajaxResponse.msg);
    }
});
The api.jsp returns its data in ISO-8859-1. The response contains special characters (German Umlauts) that are not displayed correctly, even if I add a "encoding: ISO-8895-1" to the AJAX-request. Does anyone know how to fix this?
If I call api.jsp in a new browser window separately the special characters are also corrupt. And I can't get any information about the used encoding in the response header. The response header looks like this:
Server  Apache-Coyote/1.1
Content-Type    application/json
Content-Length  208
Date    Thu, 29 Apr 2010 14:40:24 GMT
Notice: Please don't advice the usage of UTF-8. I have to deal with ISO-8859-1.
© Stack Overflow or respective owner