[postgis-users] shp2pgsql and encoding issues

Mike Leahy mgleahy at fes.uwaterloo.ca
Tue May 24 09:37:22 PDT 2005


Tom,

I had the same problem a while ago, and found that if my database is set
to SQL_ASCII it would work fine...though I think you can only set the
encoding when the database is created.  I tried using some text editors
to convert the characters in the script created by the shp2pgsql tool,
but that didn't work.  I was able to use find/replace to change special
characters (in Spanish) to unicode-compatible characters, which sort-of
worked, but I didn't really want to get rid of those characters.  I
found it was just easier to create my database in SQL_ASCII from the
start.  Perhaps somebody else has a more effective solution...

Mike



Kralidis,Tom [Burlington] wrote:

>Hi,
>
>I have some polygon data in the form of a .shp/.shx/.dbf set which I'd
>like to store in PostGIS.  The .dbf table has some French characters
>
>My database is set in UNICODE, but judging from the errors below, it
>looks like the .dbf data is NOT in unicode.  I'm not sure how shp2pgsql
>deals with languages, or whether this is resolved from the DB config, or
>shell environment variables, or both, etc.
>
>Here is the output of my shp2pgsql attempt:
>
>$ /usr/local/pgsql/bin/shp2pgsql  -s 42304 wshed_p public.wshed_p |
>/usr/local/pgsql/bin/psql -d devgeodb -U postgres
>Shapefile type: Polygon
>Postgis type: MULTIPOLYGON[2]
>BEGIN
>NOTICE:  CREATE TABLE will create implicit sequence "wshed_p_gid_seq"
>for serial column "wshed_p.gid"
>CREATE TABLE
>                      addgeometrycolumn
>-------------------------------------------------------------
> public.wshed_p.the_geom SRID:42304 TYPE:MULTIPOLYGON DIMS:2
> geometry_column fixed:0
>(1 row)
>
>INSERT 25196 1
>INSERT 25198 1
>INSERT 25200 1
>INSERT 25203 1
>INSERT 25206 1
>INSERT 25208 1
>INSERT 25211 1
>INSERT 25213 1
>ERROR:  Unicode characters greater than or equal to 0x10000 are not
>supported
>ERROR:  current transaction is aborted, commands ignored until end of
>transaction block
>ERROR:  current transaction is aborted, commands ignored until end of
>transaction block
>ERROR:  current transaction is aborted, commands ignored until end of
>transaction block
>ERROR:  current transaction is aborted, commands ignored until end of
>transaction block
>Cancel request sent
>ERROR:  current transaction is aborted, commands ignored until end of
>transaction block
>
>Any ideas or suggestions would be much appreciated.
>
>Thanks
>
>..Tom
>
>=========================
>Tom Kralidis
>Senior Systems Scientist
>Environment Canada
>Tel: +01-905-336-4409
>http://www.ec.gc.ca/
>_______________________________________________
>postgis-users mailing list
>postgis-users at postgis.refractions.net
>http://postgis.refractions.net/mailman/listinfo/postgis-users
>
>  
>



More information about the postgis-users mailing list