Re: invalid byte sequence for encoding "UTF8"

From: "Chad Wagner" <chad(dot)wagner(at)gmail(dot)com>
To: "Gary Benade" <gary(at)softwareguys(dot)co(dot)za>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: invalid byte sequence for encoding "UTF8"
Date: 2007-01-16 23:30:00
Message-ID: 81961ff50701161530u1c2fefc6gb1d80040233cf3ef@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On 1/16/07, Gary Benade <gary(at)softwareguys(dot)co(dot)za> wrote:
>
> I used shp2pgsql.exe to create an import sql for my gis database.
> The resultant sql has data like this in it.INSERT INTO "gis"."sa_area"
> ("label","type","level",the_geom) VALUES
> ('MÔRELIG','0x2','2','0106000000010000000');
> The Ô is ascii char 212.
> This wont import, PSQL returns
> ERROR: invalid byte sequence for encoding "UTF8": 0xd452
> HINT: This error can also happen if the byte sequence does not match the
> encoding expected by the server, which is controlled by "client-encoding"
>

I am not terribly familiar with PostGIS (other than installing it, running
the test cases and saying cool :), but it appears that your source data is
probably ISO-8859-1. You should probably use the -W switch with shp2pgsql
and specify the client encoding as "LATIN1", it should write a dump file
with SET client_encoding to 'LATIN1' instead of UTF8 (or you can manually
tweak the SQL file).

--
Chad
http://www.postgresqlforums.com/

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Chad Wagner 2007-01-16 23:38:06 Re: Mounting a data dir read only
Previous Message Patrick Earl 2007-01-16 22:47:09 GUID/UUID Support