Hello, On Wed, Aug 04, 2010 at 11:03:53PM +0200, Marc Dequènes (Duck) wrote: > I just found this in my logs, several times: > Jul 29 05:26:23 Toushirou dicod[21709]: Error: Traceback (most > recent call last): > Jul 29 05:26:23 Toushirou dicod[21709]: Error: File > "/usr/share/dico/python/mediawiki.py", line 91, in match_word > Jul 29 05:26:23 Toushirou dicod[21709]: Error: for k in result[1]: > Jul 29 05:26:23 Toushirou dicod[21709]: Error: UnicodeEncodeError: > 'ascii' codec can't encode character u'\xee' in position 4: ordinal > not in range(128) ---end quoted text---
Could you try the attached patch (from upstream git), and see if it fixes the issue ? I see that it modifies code around the line that caused the error. -- أحمد المحمودي (Ahmed El-Mahmoudy) Digital design engineer GPG KeyID: 0xEDDDA1B7 GPG Fingerprint: 8206 A196 2084 7E6D 0DF8 B176 BC19 6A94 EDDD A1B7
diff --git a/app/python/mediawiki.py b/app/python/mediawiki.py index 7410c8c..ffe5135 100644 --- a/app/python/mediawiki.py +++ b/app/python/mediawiki.py @@ -1,7 +1,7 @@ # -*- coding: utf-8 -*- # # This file is part of GNU Dico. -# Copyright (C) 2008, 2009 Wojciech Polak +# Copyright (C) 2008, 2009, 2010 Wojciech Polak # # GNU Dico is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by @@ -31,7 +31,7 @@ except ImportError: import dico -__version__ = '1.01' +__version__ = '1.02' class DicoModule: user_agent = 'Mozilla/1.0' @@ -89,8 +89,8 @@ class DicoModule: if strat.has_selector: fltres = [] for k in result[1]: - if strat.select (k, key): - fltres.append (k) + if strat.select (k.encode ('utf_8'), key): + fltres.append (k.encode ('utf_8')) if fltres.count > 0: return ['match', sorted(fltres, key=unicode.lower)] else: @@ -127,9 +127,9 @@ class DicoModule: def result_headers (self, rh, hdr): if dico.current_markup () != 'wiki': hdr['Content-Type'] = 'text/plain'; - elif self.wikihost.find ('.wikipedia.org') != -1: + elif '.wikipedia.org' in self.wikihost: hdr['Content-Type'] = 'text/x-wiki-wikipedia'; - elif self.wikihost.find ('.wiktionary.org') != -1: + elif '.wiktionary.org' in self.wikihost: hdr['Content-Type'] = 'text/x-wiki-wiktionary'; else: hdr['Content-Type'] = 'text/x-wiki';
signature.asc
Description: Digital signature