Re: Character Encoding Question

From: Don Parris <parrisdc(at)gmail(dot)com>
To: psycopg(at)postgresql(dot)org
Subject: Re: Character Encoding Question
Date: 2013-03-28 20:59:06
Message-ID: CAJ-7yomAZcYQE=M0x6Evy+YFKWekAvfrQhU-4CzHPFe2m9vzdg@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: psycopg

On Thu, Mar 28, 2013 at 1:12 PM, Federico Di Gregorio <fog(at)dndg(dot)it> wrote:

> On 28/03/2013 17:41, Daniele Varrazzo wrote:
> > On Thu, Mar 28, 2013 at 4:34 PM, Don Parris <parrisdc(at)gmail(dot)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.

In response to

Responses

Browse psycopg by date

  From Date Subject
Next Message Daniele Varrazzo 2013-03-28 23:07:38 Re: Character Encoding Question
Previous Message Don Parris 2013-03-28 20:49:13 Re: Character Encoding Question