Re: utf8 issue - Mailing list pgsql-general

From Alvaro Herrera
Subject Re: utf8 issue
Date
Msg-id 20080226210028.GM5763@alvh.no-ip.org
Whole thread Raw
In response to utf8 issue  (Tom Hart <tomhart@coopfed.org>)
List pgsql-general
Tom Hart wrote:
> Hello everybody. I recently converted my db from ASCII encoding to UTF8
> (we have a lot of spanish-speaking members, and need the extra character
> support). Everything was working great, but I noticed this error, while
> trying to COPY one of our tables from a csv.
>
> ERROR: invalid byte sequence for encoding "UTF8": 0xb9
> SQL state: 22021
> 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".
> Context: COPY transaction_import, line 59358

Did you try setting client_encoding beforehand?  I think a simple

PGOPTIONS="client_encoding=latin9" pg_restore ...

should suffice.

Now, if you have mixed UTF8 and Latin1/Latin9 data, you are hosed
(meaning you'll have to wade through the stuff and figure out what data
is in what encoding, and fix it).

--
Alvaro Herrera                                http://www.CommandPrompt.com/
The PostgreSQL Company - Command Prompt, Inc.

pgsql-general by date:

Previous
From: "Scott Marlowe"
Date:
Subject: Re: How to copy tables between databases?
Next
From: Tom Hart
Date:
Subject: Re: utf8 issue