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 <dhee...@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@postgis.refractions.net > http://postgis.refractions.net/mailman/listinfo/postgis-users > > _______________________________________________ postgis-users mailing list postgis-users@postgis.refractions.net http://postgis.refractions.net/mailman/listinfo/postgis-users