[mapserver-users] how does mapserver determine shapefile encoding?

Carlos Ruiz boolean10001 at yahoo.com
Tue Aug 2 13:01:13 PDT 2011


Lars,

When you try to load some data to a PostgreSQL server, you can specify the encoding to use.

This can be done with client_encoding. For example, if you want to populate a table with some CSV file contents, you have 

to do the following:


SET client_encoding = 'LATIN1';
COPY my_table FROM '/usr/file.csv' WITH CSV


Now, when you use shp2pgsql you can't set the client encoding, but you can set the default client_encoding of your 

database and every data transfer between some client and your database will be encoded properly:

ALTER DATABASE my_database SET client_encoding = 'LATIN1'


Hope this helps

Cheers from Guadalajara, México


IC Carlos Ruiz



________________________________
From: Lars Lingner <gislars+list at googlemail.com>
To: "'mapserver-users at lists.osgeo.org'" <mapserver-users at lists.osgeo.org>
Sent: Tuesday, August 2, 2011 2:45 PM
Subject: [mapserver-users] how does mapserver determine shapefile encoding?

Hello,

I have a shapefile from which I don't really know the encoding. It might
be latin1 or ISO-8559-5. The good thing is, when MapServer is accessing
the shapefile, the labels are shown correct.
QGis is also displaying everything fine.

But when I try to convert with shp2pgsql or ogr I get only garbage back.
I tried different source encodings. Since I need the data to be in the
database I'm now trying to find out where the problem is.

I tried converting the data on different systems (Ubuntu, RedHat), with
postgis/shp2pgsql from repository as well as self compiled. Same
results. Also iconv and recode wasn't a help.

As I said QGis is displaying everything fine it fails in converting the
shapefile too. Opening the dbf in LibreOffice doesn't helped either.

Finally my (odd) questions are: Why does MapServer do everything right?
How is the encoding determined? Can I see somewhere which encoding is
used by MapServer?

Thanks in advance for any pointers.


Lars
_______________________________________________
mapserver-users mailing list
mapserver-users at lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/mapserver-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/mapserver-users/attachments/20110802/5b8b5fba/attachment.htm>


More information about the MapServer-users mailing list