Am 27.09.2007 um 17:20 schrieb blunderer:
> Hi, I'm trying to use genshi.i18n.Translator module to
translate TEXT
> nodes in my web pages.
>
> The stream is generated using XML object and I apply
the filter
> "Translator(gettext)" to this stream :
> It results in a UnicodeDecodeError (in File
"build/bdist.linux-i686/
> egg/genshi/filters/i18n.py", line 181, in
__call__).
>
> The data field in the stream causing that is :
> - kind : TEXT
> - data : "Paramètres"
> data is a unicode object and file parsed by XML is
UTF-8 encoded.
>
> If I insert a filter "spy" before the
Translator and I replace data
> by :
> unicode("Paramètres","UTF-8")
> it's working fine.
>
> I tought : maybe the data field of the stream is just
in the wrong
> format and I tryied with :
>
unicode(data.encode("UTF-8"),"UTF-8")
> But the result is the same : a UnicodeDecodeError.
>
> maybe I'm doing something else wrong, if somebody has
an idea, please
> let me know.
Try using the "ugettext" function instead of
"gettext"; it returns
unicode objects.
Cheers,
Chris
--
Christopher Lenz
cmlenz at gmx.de
http://www.cmlenz.net/
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the
Google Groups "Genshi" group.
To post to this group, send email to genshi googlegroups.com
To unsubscribe from this group, send email to
genshi-unsubscribe googlegroups.com
For more options, visit this group at http://gr
oups.google.com/group/genshi?hl=en
-~----------~----~----~----~------~----~------~--~---
|