Re: psycopg2.Error.pgerror encoding ?

Поиск
Список
Период
Сортировка
От Daniele Varrazzo
Тема Re: psycopg2.Error.pgerror encoding ?
Дата
Msg-id CA+mi_8acZsFSswM3w1m7B7pMY5xhtc34tuAbD0v80Mec-yjq_g@mail.gmail.com
обсуждение исходный текст
Ответ на psycopg2.Error.pgerror encoding ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Ответы Re: psycopg2.Error.pgerror encoding ?  (Karsten Hilbert <Karsten.Hilbert@gmx.net>)
Список psycopg
On Wed, Nov 13, 2013 at 1:52 AM, Karsten Hilbert
<Karsten.Hilbert@gmx.net> wrote:
> I have a simple (?) question regarding psycopg2.Error
>
>         http://initd.org/psycopg/docs/module.html#exceptions
>
> Which encoding is the string attribute .pgerror
> going to be in ?

In Python 2 it will be in the connection encoding; specifically we
receive the 8-bit message from the backend and we just create a Python
string out of that data, without re-checking the data is valid in that
encoding (we trust the database).

In Python 3 it is unicode decoded with the connection encoding (with
"replace" error handling, because we trust the database, yet we don't
want to die if things have gone really awry).

-- Daniele


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

Предыдущее
От: Karsten Hilbert
Дата:
Сообщение: psycopg2.Error.pgerror encoding ?
Следующее
От: Karsten Hilbert
Дата:
Сообщение: Re: psycopg2.Error.pgerror encoding ?