[Geomoose-users] Data from queries in different encodings than UTF-8

Matej matej at matnet.net
Sun Nov 9 13:54:23 EST 2008


Hi,

I have been looking at that problem with special characters that I get as a result from the query. The data is stored in the ISO-8859-2 (Latin 2) encoding. 

As I mentioned before, my thoughts that the problem is somehow connected with the getHTTPObject, now seem to be true. This seems to be an IE "bug", i.e. I am unable to find a solution to get it to work in both IE and FireFox at least. 

The address of the script is: http://liam.odpri.si/~matej/charset/index.php. I managed to get it to work in the FireFox, but IE doesn't seem to have the function overrideMimeType with which I am able to set the proper encoding. The http://liam.odpri.si/~matej/charset/return.php file doesn't do anything but just returns (echoes) the symbol "sh" in the ISO-8859-2 encoding. When I open this return.php in no matter which browser (and set the encoding to the ISO-8859-2), I always successfully get this symbol printed as it should be.

The function doWork is just that:
function doWork(){
    httpObject = getHTTPObject();
    if (httpObject != null) {
        httpObject.open("GET", "return.php", true);
        if (httpObject.overrideMimeType) { httpObject.overrideMimeType("text/html; charset=ISO-8859-2"); }
//if I do not do "if", there is an error in IE7 popped up
        httpObject.send(null);
        httpObject.onreadystatechange = setOutput;
    }
}

I already tried with "\httpObject.setRequestHeader("Content-Type", "text/html; charset=ISO-8859-2")\", but then in IE7 the "?" is printed instead of "sh".

Here are some maybe useful link for this entire problem:
- http://squio.nl/blog/2006/06/27/xmlhttprequest-and-character-encoding/
- http://www.dynamicdrive.com/forums/archive/index.php/t-23633.html
- http://www.activewidgets.com/javascript.forum.12114.10/no-subject.html

This is my little bit of information found out so far. I hope there will be a solution for this thing.

Matej Serc
matej at matnet.net
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.osgeo.org/pipermail/geomoose-users/attachments/20081109/93eae9dd/attachment.html


More information about the Geomoose-users mailing list