Re: How to find freak UTF-8 character? - Mailing list pgsql-general

From Daniele Varrazzo
Subject Re: How to find freak UTF-8 character?
Date
Msg-id CA+mi_8bFpk6h5cuU+xjfSrb8nu1+V4_31xccGFyn+TumPZiCJw@mail.gmail.com
Whole thread Raw
In response to Re: How to find freak UTF-8 character?  (Leif Biberg Kristensen <leif@solumslekt.org>)
List pgsql-general
On Sat, Oct 1, 2011 at 10:16 PM, Leif Biberg Kristensen
<leif@solumslekt.org> wrote:
> Yes I know that this is a perfectly legal UTF-8
> character. It crept into my database as a result of a copy-and-paste job from
> a web site. The point is that it doesn't have a counterpart in ISO-8859-1 to
> which I regularly have to export the data.

If your database is utf8 and the output latin1, it sounds more robust
to connect to the database with utf8 client encoding, pull data from
the database as unicode and at output time use data.encode('latin1',
'replace') in python to convert data without bombing on non-latin1
chars.

-- Daniele

pgsql-general by date:

Previous
From: John R Pierce
Date:
Subject: Re: stored function (possible to access file system or call java program)?
Next
From: Bob Hatfield
Date:
Subject: Replication/WAL shipping. db errors on slave after stop/start master