Re: Weird unicode problem - Mailing list psycopg

From Daniele Varrazzo
Subject Re: Weird unicode problem
Date
Msg-id CA+mi_8Z0m8yuNKL6yobPK8_Pm6qS65hzWr_t=9k1E+pfeO-=Gg@mail.gmail.com
Whole thread Raw
In response to Weird unicode problem  (Dick Kniep <dick@lindix.nl>)
List psycopg
On Wed, Apr 15, 2015 at 2:50 PM, Dick Kniep <dick@lindix.nl> wrote:
> DataError: character with byte sequence 0xe2 0x82 0xac in encoding "UTF8" has no equivalent in encoding "LATIN1"

This is a PostgreSQL error: most likely your connection encoding is in
LATIN1 instead of UTF8. Proof is also that you get the error on
execute (which is normally when the data is transferred to psycopg)
and not on fetch*() (when the typecasters are applied).

Try running "show client_encoding" in you database in psql to check if
this is the case. If not, there could be something in your python code
changing the encoding: check the value of cnn.encoding where the code
is executed.

The client encoding can be changed in psycopg with a
cnn.set_client_encoding('utf8').

-- Daniele


psycopg by date:

Previous
From: Dick Kniep
Date:
Subject: Weird unicode problem
Next
From: "Vamsi Krishna Reddy -T (vamsredd - TATA CONSULTANCY SERVICES LIMITED at Cisco)"
Date:
Subject: Need help with the installation of psycopg2 module in a python virtual env