[OpenLayers-Users] character encoding

Arnd Wippermann arnd.wippermann at web.de
Wed Dec 5 17:32:56 EST 2007


Hi,

To declare your proxy, you set something like this:
 OpenLayers.ProxyHost = "http://localhost/cgi-bin/proxy.cgi?url=";

If you use this function, the above script will used to retrieve the data
 OpenLayers.loadURL(url, '', this, setHTML);

If you have the OpenLayers source, there is a python proxy script proxy.cgi
in the examples directory.

You have to include this in your web server environment. Look at the
OpenLayers mailling list for further informations.

If this is running, I have used a trick to get special characters. There
seems no easy way in python to translate special character into html
entities. So I escape in the proxy-script the response to the ajax call and
after that unescape the response from the ajax-function.

proxy-script, change row : print y.read() to: print urllib.quote(y.read())

html-file, change: response.responseText; to:
unescape(response.responseText);

I have this tested locally with my apache server and it delivers the äöüs
etc..

Mit freundlichen Grüssen

Arnd Wippermann
http://gis.ibbeck.de/ginfo/





-----Ursprüngliche Nachricht-----
Von: users-bounces at openlayers.org [mailto:users-bounces at openlayers.org] Im
Auftrag von R. Ortner
Gesendet: Mittwoch, 5. Dezember 2007 11:07
An: users at openlayers.org
Betreff: Re: [OpenLayers-Users] character encoding


Thanks for your replay and i basically know what u mean but I have
absolutely no idea how such a proxy script looks like, how i put it into my
Application and how do i call it?

would be very grateful for explizit examples (couldnt find a proxy-script in
the link below)



Arnd Wippermann wrote:
> 
> Hi,
> 
> If you use OpenLayers.loadURL(url, '', this, setHTML); like in the ol 
> example, then your request use Ajax. Therefor you need a proxy-script. 
> In this script you can change the special char to html entities.
> 
> With asp I use this function:
>  
> Response.Write server.HTMLEncode(objXmlHttp.responseText)
> 
>
http://gis.ibbeck.de/ginfo/apps/olexamples/sphericalmercator/wms_getfeature.
> html
> 
> Mit freundlichen Grüssen
> 
> Arnd Wippermann
> http://gis.ibbeck.de/ginfo/
> 
> 
> 
> -----Ursprüngliche Nachricht-----
> Von: users-bounces at openlayers.org 
> [mailto:users-bounces at openlayers.org] Im Auftrag von R. Ortner
> Gesendet: Dienstag, 4. Dezember 2007 12:15
> An: users at openlayers.org
> Betreff: [OpenLayers-Users] character encoding
> 
> 
> hi,
> 
> I´ve still trouble with my special character encoding.
> 
> -The database is in Latin1 and in Win-1252 (both capable of special 
> caracters like ö,ä,ü,²,...) -the OL.php file is defined in the head 
> sectoin as Iso-8859-1 -the template.html specified in the mapfile is 
> defined as
> Iso-8859-1
> 
> when I call the GetFeatureInfo request in the browser it is displayed 
> correctly (also in qgis or gvsig), when i call it witin the OL 
> application no special character is displayed(only ? as symbols) not 
> even the special characters in "plain" text in the template file. (I 
> have a table, in one row i wrote some text like "länge" in the second 
> row is the GetInfoRequest from the database) Then it writes "l?nge" 
> instead of "länge"
> 
> so i don´t think the database is responsible for that and not the 
> template file specified in Iso-8859-1!
> 
> is there a way to tell the mapserver to send the characters in 
> Iso-8859-1 or something in OL to define?
>      Because either the mapserver send it wrong or it is displayed 
> wrong by OL.
> 
> Or can I somehow send the encoding with the getFeatureInfo request?
> 
> --
> View this message in context:
> http://www.nabble.com/character-encoding-tf4942492.html#a14148746
> Sent from the OpenLayers Users mailing list archive at Nabble.com.
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> _______________________________________________
> Users mailing list
> Users at openlayers.org
> http://openlayers.org/mailman/listinfo/users
> 
> 

--
View this message in context:
http://www.nabble.com/character-encoding-tf4942492.html#a14168481
Sent from the OpenLayers Users mailing list archive at Nabble.com.

_______________________________________________
Users mailing list
Users at openlayers.org
http://openlayers.org/mailman/listinfo/users




More information about the Users mailing list