Re: utf8 issue

From: Tom Hart <tomhart(at)coopfed(dot)org>
To: Richard Huxton <dev(at)archonet(dot)com>
Cc: Postgres General List <pgsql-general(at)postgresql(dot)org>
Subject: Re: utf8 issue
Date: 2008-02-26 21:04:05
Message-ID: 47C47EC5.2030602@coopfed.org
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

Richard Huxton wrote:
> 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
>
> Not converted, I fear.
>
> Why not use latin9 rather than utf8 - that should cover everything and
> is probably what it's in anyway.
I was specifically requested to use UTF-8, and the work's already been
done, so converting again is not my favorite option.
>
>> Is there anything I can do to look for these sorts of errors and fix
>> them? I'm really not great with character encodings and I'm not sure
>> where to go on this. Any help?
>
> Google a bit for iconv (and postgresql) to get your characters valid.
>
I already have a php script that does some data scrubbing before the
copy. I added this line to the script and things seem to be working
better now

$line = iconv("ISO-8859-1", "UTF-8", $line);

Thanks for the help guys :-)

--
Tom Hart
IT Specialist
Cooperative Federal
723 Westcott St.
Syracuse, NY 13210
(315) 471-1116 ext. 202
(315) 476-0567 (fax)

In response to

Responses

  • Re: utf8 issue at 2008-02-26 21:55:56 from Dean Gibson (DB Administrator)

Browse pgsql-general by date

  From Date Subject
Next Message Ralph Smith 2008-02-26 21:26:58 Re: v7.4 pg_dump(all) need to encode from SQL_ASCII to UTF8
Previous Message Alvaro Herrera 2008-02-26 21:00:28 Re: utf8 issue