[Twisted-Python] adbapi, PostgreSQL and Unicode
Remy Cool
mailinglists at smartology.nl
Wed May 11 09:28:17 EDT 2005
Matt Goodall wrote:
> Michal Eldar wrote:
>
>
>>I keep getting - Unhandled error in Deferred
>
>
> You should attach an errback to the deferred and handle, or at least
> log, the exception. That's what "Unhandled error in Deferred" means ;-).
>
>
>>I'm trying to perform an INSERT on my db (using adbapi with *pgdb*
>>module).
>>INSERT which comprises *Unicode* string
>>e.g. -
>>unicodeChar1 = u"Character=[\N{GREEK CAPITAL LETTER GAMMA}]"
>>
>>the db is defined to Unicode
>>*client_encoding* value is set to *Unicode* when checking its value in
>>*cp_openfun *called function
>>execute the same INSERT directly with *pgdb *works great
>>
>>Does anyone has experience with adbapi with Unicode db ?!?!
<snip>
I also use pgdb with adbapi and unicode without problems. Insert's with
unicode strings should not be problem even if the database is set to
SQLASCII. The pgdb module inspects the string before sending it to the
postgres machinery. If it's a unicode string (isinstance('the string',
unicode) ) it's encoded to utf-8.
I've submitted a patch to Darcy at pygresql.org for enhanced unicode
support for pgdb. This patch takes care of the client_encoding stuff and
makes it possible to fetch unicode strings from select queries.
-- Remy --
More information about the Twisted-Python
mailing list