Re: How to find freak UTF-8 character?

From: Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com>
To: Leif Biberg Kristensen <leif(at)solumslekt(dot)org>
Cc: pgsql-general(at)postgresql(dot)org
Subject: Re: How to find freak UTF-8 character?
Date: 2011-10-04 17:25:07
Message-ID: CA+mi_8bFpk6h5cuU+xjfSrb8nu1+V4_31xccGFyn+TumPZiCJw@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-general

On Sat, Oct 1, 2011 at 10:16 PM, Leif Biberg Kristensen
<leif(at)solumslekt(dot)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

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Bob Hatfield 2011-10-04 17:27:35 Replication/WAL shipping. db errors on slave after stop/start master
Previous Message John R Pierce 2011-10-04 16:18:56 Re: stored function (possible to access file system or call java program)?