On Thu, Aug 19, 2010 at 7:04 AM, [email protected] <
[email protected]> wrote:
> UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position
> 0: ordinal not in range(128)
>
This error means mako received non-unicode string, tried to cast
unicode(string) on it, and failed due to unknown encoding.
>
> The code cause this problem is ${feed.plain_text | n}.
>
Quick fix would be ${feed.plain_text.decode('utf-8') | n}.
But its better to ensure that your strings are unicode at controller, where
you produce that feed.plain_text.
> One thing to note that I haven't mentioned the utf-8 in the mako
> coding lines. Is that required?
>
>
If you mean # -*- coding: utf-8 -*- , no, it is not required if your mako
template itself does not contain non-ASCII characters.
--
With best regards,
Daniel Kluev
--
You received this message because you are subscribed to the Google Groups
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/pylons-discuss?hl=en.