Strange problems with encoding

Sebastian Meyer s.meyer at
Thu Nov 6 17:31:47 CET 2003

On Thu, 06 Nov 2003 15:10:49 +0100, Sebastian Meyer wrote:

> On Thu, 06 Nov 2003 13:39:25 +0000, Michael Hudson wrote:
>> 2) I presume `str' is a unicode string?  Try writing the literal as
>>    u'ö' instead (and adding the appropriate coding cookie to your
>>    source file if using Python 2.3).  Or I guess you could write it
> i ll try and report back...

okay, i ve solved my problem... it seems that my method which tries
to insert the data i process into the database raises the error. The
data comes from XML files, my derived xml.sax.handler.ContentHandler
returns UniCode encoded data. The database routine tries to
encode the values as ASCII and --**BOOOM**-- ... Exception.

I now replace the special characters by their UniCode Names
eg. u'\N{LATIN SMALL LETTER O WITH DIAERESIS}' (thanks for the hint
michael), now all for works fine... ;-))

thanks for the great help NG


More information about the Python-list mailing list