Unix Technical Forum

invalid byte sequence for encoding "UTF8"

This is a discussion on invalid byte sequence for encoding "UTF8" within the Pgsql General forums, part of the PostgreSQL category; --> I used shp2pgsql.exe to create an import sql for my gis database. The resultant sql has data like this ...


Go Back   Unix Technical Forum > Database Server Software > PostgreSQL > Pgsql General

FAQ Members List Calendar Search Today's Posts Mark Forums Read
  #1 (permalink)  
Old 04-09-2008, 02:24 PM
Gary Benade
 
Posts: n/a
Default invalid byte sequence for encoding "UTF8"

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

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #2 (permalink)  
Old 04-09-2008, 02:24 PM
Martijn van Oosterhout
 
Posts: n/a
Default Re: invalid byte sequence for encoding "UTF8"

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 controlled by "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.


-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.1 (GNU/Linux)

iD8DBQFFrOS1IB7bNG8LQkwRAnQNAJ9laHEWi1LJotNGA6F9Ya fp0wWRjACfTdna
NYVegugT7htvcuIbufUZxws=
=dz2s
-----END PGP SIGNATURE-----

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
  #3 (permalink)  
Old 04-09-2008, 02:25 PM
Chad Wagner
 
Posts: n/a
Default Re: invalid byte sequence for encoding "UTF8"

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/

Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump


All times are GMT. The time now is 09:07 AM.


Powered by vBulletin® Version 3.6.5
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
SEO by vBSEO 3.2.0
www.UnixAdminTalk.com