From: | Daniele Varrazzo <daniele(dot)varrazzo(at)gmail(dot)com> |
---|---|
To: | Don Parris <parrisdc(at)gmail(dot)com> |
Cc: | psycopg(at)postgresql(dot)org |
Subject: | Re: Character Encoding Question |
Date: | 2013-03-28 23:07:38 |
Message-ID: | CA+mi_8YjzjFdAiO-R=u7-h_hgWUCurycc=66o+AX3jmzRDZ=4Q@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | psycopg |
On Thu, Mar 28, 2013 at 8:49 PM, Don Parris <parrisdc(at)gmail(dot)com> wrote:
> On Thu, Mar 28, 2013 at 1:30 PM, Daniele Varrazzo
>> >Try (without setting the encoding to utf8):
>>
>> cur.execute("select [ your stuff, including non-ascii records")
>> while 1:
>> record = cur.fetchone()
>> if not record:
>> break
>>
>> I'm pretty sure you will get an encoding error too.
>>
> You are right about this. It stopped at record #7 (entity_id = 7) and gave
> me the traceback. That is, record #7 was the last record printed. Does
> that have anything to do with the position mentioned in the traceback?
> Would #8 have been the 'guilty' record?
yes: try again setting the encoding to utf8 and you'll see a record
with a non-ascii char: it could be "Piña Colada Resort".
> This record was loaded (as were all of the first 80-100 in this table) via
> \copy command from within psql. The remaining records have been inserted
> manually via PGAdmin
Your database is probably fine and perfectly encoded. If there's
anything to be understood is why psycopg connects by default with a
SQL_ASCII encoding - which is not good to transfer the ñ char or any
other char with ascii value > 127. The answer could be, from the most
general to the most specific, in the postgresql.conf (global setting),
in the pg_user view (per-user setting), in some environment variable
(per-connection setting). Which one of these settings say
client_encoding=sql_ascii?
I bet it's the first.
-- Daniele
From | Date | Subject | |
---|---|---|---|
Next Message | Joe Abbate | 2013-03-29 01:21:18 | Re: Character Encoding Question |
Previous Message | Don Parris | 2013-03-28 20:59:06 | Re: Character Encoding Question |