[postgis-users] shp2pgsql encoding question

Paul Ramsey pramsey at opengeo.org
Tue Feb 22 19:04:11 PST 2011


Dheeraj,
Your database encoding is UTF-8. Your shape file appears to have a
LATIN1 character in it. In order for the insert to work, you will need
to transcode the shape file. Fortunate, shp2pgsql has a commandline
option, -w.

shp2pgsql -w LATIN1 -s 4326 tl_2009_us_county public.counties

Happy transcoding,
P

On Tue, Feb 22, 2011 at 6:56 PM, Dheeraj Chand <dheeraj at dheerajchand.com> wrote:
> Hi, everyone,
> I think that I can describe this as a very, very stupid encoding question.
> I'm getting an error in shp2pgsql about changing the encoding of the
> database, and when I try changing via the \encoding function, I find that
> the changes are not sticking.  Is there a better way to do this?
> tardis-2:County Shapefile dheerajchand$ shp2pgsql -s 4326 tl_2009_us_county
> public.counties | psql -U dheerajchand -h localhost -p 5432 -d jamaa
> Shapefile type: Polygon
> Postgis type: MULTIPOLYGON[2]
> SET
> SET
> BEGIN
> NOTICE:  CREATE TABLE will create implicit sequence "counties_gid_seq" for
> serial column "counties.gid"
> NOTICE:  CREATE TABLE / PRIMARY KEY will create implicit index
> "counties_pkey" for table "counties"
> CREATE TABLE
>                       addgeometrycolumn
> --------------------------------------------------------------
>  public.counties.the_geom SRID:4326 TYPE:MULTIPOLYGON DIMS:2
> (1 row)
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> INSERT 0 1
> Unable to convert data value to UTF-8 (iconv reports "Illegal byte
> sequence"). Current encoding is "UTF-8". Try "LATIN1" (Western European), or
> one of the values described at
> http://www.postgresql.org/docs/current/static/multibyte.html.
> INSERT 0 1
> tardis-2:County Shapefile dheerajchand$
>
> _______________________________________________
> 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