the error from the debugger is the following
"Module _main_main_mako:60 in render_body
>> context.write(unicode(c.page.body))
<type 'exceptions.UnicodeDecodeError'>: 'ascii' codec can't decode
byte 0xc3 in position 4775: ordinal not in range(128) "
[where c.page.body is the result of another render('innerpage.mako')
which does contain c.name]
the sqlalchemy url contains the params ("?
use_unicode=1&charset=utf8"), which i assume means the results of my
queries are unicode
i am confused because, in the interactive debugger, if i print out the
variable "c.name"
i see that it is unicode and i am able to successfully run
unicode(c.name)
but it seems that mako is failing on the same operation. i have tried
including "# -*- coding: utf-8 -*- " at the top of mako files, but it
did not work. also, i assumed we didn't have to do this in the 0.9.6
as utf8 output by mako is the default...
if i remove reference to ${c.name} in my mako file, all is well....
On Nov 18, 7:32 am, Christoph Haas <[EMAIL PROTECTED]> wrote:
> On Sun, Nov 18, 2007 at 01:20:54AM -0800, eleith wrote:
> > i meant
>
> > <div> ${c.name}</div>
>
> I figured. :)
>
> Did you declare your Mako template file as UTF8? I always prepend my
> template files with:
>
> # -*- coding: utf-8 -*-
>
> Since Pylons 0.9.6 you do not need to do any fancy encoding stunts. Just
> pass around unicode strings and declare the encoding of your templates
> correctly and that should be it.
>
> Christoph
--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---