Re: Character Encoding Question

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: Character Encoding Question
Дата
Msg-id CA+mi_8YjzjFdAiO-R=u7-h_hgWUCurycc=66o+AX3jmzRDZ=4Q@mail.gmail.com
обсуждение исходный текст
Ответ на Re: Character Encoding Question  (Don Parris <parrisdc@gmail.com>)
Ответы Re: Character Encoding Question  (Don Parris <parrisdc@gmail.com>)
Список psycopg
On Thu, Mar 28, 2013 at 8:49 PM, Don Parris <parrisdc@gmail.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


В списке psycopg по дате отправления:

Предыдущее
От: Don Parris
Дата:
Сообщение: Re: Character Encoding Question
Следующее
От: Joe Abbate
Дата:
Сообщение: Re: Character Encoding Question