Re: utf8 issue

From: Alvaro Herrera <alvherre(at)commandprompt(dot)com>
To: Tom Hart <tomhart(at)coopfed(dot)org>
Cc: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: utf8 issue
Date: 2008-02-26 21:00:28
Message-ID: 20080226210028.GM5763@alvh.no-ip.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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.

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Tom Hart 2008-02-26 21:04:05 Re: utf8 issue
Previous Message Scott Marlowe 2008-02-26 21:00:26 Re: How to copy tables between databases?