Python 2.5.2 on Ubuntu Hardy Utf-8-Euro error

Peter Otten __peter__ at web.de
Fri May 30 14:25:57 EDT 2008


"Martin v. Löwis" wrote:

>>> File
>>> "/usr/lib/python2.5/site-packages/Dabo-0.8.3-py2.5.egg/dabo/db/dCursorMixin.py",
>>> line 281, in execute
>>>     sql = unicode(sql, self.Encoding)
>>> LookupError: unknown encoding: utf_8_euro
>> 
>> At the application (DABO) mailing list, they have pointed that this has
>> to be a Python issue.
> 
> It's definitely not a Python issue.
> 
>> As I'm a totally python newbie, I would ask if
>> somebody has experimented this kind of error, and if there is any known
>> solution. I've found no clue searching at Google right now.
> 
> The problem is that self.Encoding is incorrect - it should not be
> utf_8_euro. Instead, it should be UTF-8 (or perhaps utf_8). DABO
> shouldn't use locale.getdefaultlocale()[1], but
> locale.getpreferredencoding().

I think that is the effect of a bug:

>>> locale._parse_localename("en_US.UTF-8 at euro")
('en_US', 'utf_8_euro')

The function first normalizes the "@" away and then looks for it. Is that
the expected behaviour?

Peter



More information about the Python-list mailing list