Обсуждение: invalid byte sequence for encoding "UTF8"

Поиск
Список
Период
Сортировка

invalid byte sequence for encoding "UTF8"

От
"Gary Benade"
Дата:
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"

TIA
Gary
 

Re: invalid byte sequence for encoding "UTF8"

От
Martijn van Oosterhout
Дата:
On Tue, Jan 16, 2007 at 03:40:52PM +0200, Gary Benade 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
controlledby "client-encoding" 

Well, your data isn't UTF8 and yet that's what you told the server.
Either make the data UTF8, or tell the server the actual encoding
used...

Have a nice day,
--
Martijn van Oosterhout   <kleptog@svana.org>   http://svana.org/kleptog/
> From each according to his ability. To each according to his ability to litigate.

Вложения

Re: invalid byte sequence for encoding "UTF8"

От
"Chad Wagner"
Дата:


On 1/16/07, Gary Benade <gary@softwareguys.co.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/