[postgis-users] shp2pgsql and encoding issues

strk at refractions.net strk at refractions.net
Tue May 24 09:13:11 PDT 2005


Postgis should support these situation, but needs manual build 
so far (didn't automate it yet).

The support is curtesy of IIDA Tetsushi.

To try it out set USE_ICONV to 1 in the Makefile.config file.
You need libiconv around.
Also, if libiconv headers are not in the expected location
you need to manually modify shp2pgsql.c

One you have it build you'll have a -W flag to specify
encoding of the shapefile attributes, the produced output
should specify this encoding so that at load time pgsql
protocol will handle conversion to whatever encoding you will
use in the backend.

--strk;


On Tue, May 24, 2005 at 11:37:16AM -0400, 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