Mapserver+PostGIS+Charset encoding problems

toni hernández toni at SIGTE.UDG.ES
Wed Nov 29 09:37:31 EST 2006


hi,

have you checked fonts are installed on your server?

Marc Compte wrote:
> Hi,
>
> Sorry if this has already been dealt with before but I searched the 
> archives and couldn't find an answer for this case.
>
> I have a mapserver getting data from a PostGIS database. The database 
> charset encoding is defined as LATIN1 and the text in the tables 
> displays all fine and good in the pgAdmin as well as in my browser 
> when I just get a list of them with php.
>
> When I set that particular field as a LABEL in the map-file the 
> resulting map shows the special characters wrong (mostly accents is 
> what I have to deal with). I guess that'd be normal since I wasn't 
> specifying any charset encoding yet. So I specified this attribute in 
> my file ... but now the funny thing comes.
>
> When I set my layer to use ENCODING 'LATIN1' (same as my db) the map 
> just shows a different set of strange characters, but still not the 
> right glyphs to show.
>
> If I try using UTF-8 in my LABEL then it starts working some of the 
> accents out but not all of them. Special chars that use the accent ´ 
> appear perfectly (such as á, é, í, ó and ú), and so does the ¨ on top 
> of vowels. But the ` accent does not seem to work.
>
> I have been struggling against this problem for a few days already. 
> Now I noticed that using the UTF-8 gives me back a set of characters 
> that ressembles very much that of LATIN2.
>
> An 'à' (E0) in my database produces an 'r' with accent (´r).
> An 'è' (E8) in my database produces a 'c' with the ^ symbol on top 
> (and inverted)
> ... ì (EC) => 'e' with ^ inverted on top
> ... ò (F2) => 'n' with ^ inverted on top
> ... ù (F9) => 'u' with a º on top
>
> This leaves me very puzzled since I don't think I ever used or made 
> any reference to Latin2 charset. I am getting very confused about the 
> whole thing ... I have a db in Latin1, I try to convert it to UTF-8 
> and what I get is Latin2 ... does this make sense to anyone? I don't 
> know what else to try, I made a replica of my table in a UTF-8 db, I 
> have tried using  "options='-c client_encoding=LATIN1'" in my 
> connection string ... and always end up getting the same thing.
>
> By the way, using  "options='-c client_encoding=LATIN1'" in my 
> connection string produces exactly the same result as specifying 
> ENCODING 'UTF-8' in the LABEL of my map file, which seems also a bit 
> weird.
>
> Does anyone have any idea on what could I try next or where to look? I 
> am running out of ideas and I'm very close to go to the database and 
> strip all the accents out ...
>
> Thanks,
>
> Marc Compte
>



More information about the mapserver-users mailing list