Re: Character Encoding Question - Mailing list psycopg

From Don Parris
Subject Re: Character Encoding Question
Date
Msg-id CAJ-7yomAZcYQE=M0x6Evy+YFKWekAvfrQhU-4CzHPFe2m9vzdg@mail.gmail.com
Whole thread Raw
In response to Re: Character Encoding Question  (Federico Di Gregorio <fog@dndg.it>)
Responses Re: Character Encoding Question
List psycopg
On Thu, Mar 28, 2013 at 1:12 PM, Federico Di Gregorio <fog@dndg.it> wrote:
On 28/03/2013 17:41, Daniele Varrazzo wrote:
> On Thu, Mar 28, 2013 at 4:34 PM, Don Parris <parrisdc@gmail.com> wrote:
>> > Thanks Daniele,
>> >
>> > I'm using psycopg 2.4.5 with Python 3.2.3 on Kubuntu 12.10.
>> >
>> > This is the connection encoding based on a quick check at the Python
>> > console:
>>>>> >>>>print(con.encoding)
>> > SQLASCII
> In this case it's natural that you get an error on decode. But is it
> really the database encoding? What does this query say:

IMHO this seems very much like the "uh-oh! I put latin9 data into my
database and now I am trying to read it as unicode" problem. PostgreSQL
does NOT enforce any kind of encoding. It just converts between the
client encoding and the database one before storing the data. If you
configure any of the two encodings the wrong way is quite easy to store
data in the wrong format.

federico

Thanks  Federico,
If I created the database using the UTF-8 encoding, then why would some data be encoded differently than the rest?  And how can I control how the data gets inserted?  See my previous post, where I mentioned loading a good chunk of the data via the \copy command in psql, and then later added more via PGAdmin.  Many records seem to work just fine, but quite a few others don't - and I was just naively entering or loading data without knowing any encoding was being changed.

psycopg by date:

Previous
From: Don Parris
Date:
Subject: Re: Character Encoding Question
Next
From: Daniele Varrazzo
Date:
Subject: Re: Character Encoding Question