3 messages in com.googlegroups.pylons-discussMako unicode problems.
FromSent OnAttachments
jasa...@public.gmane.org20 Jun 2007 20:13 
Philip Jenvey24 Jun 2007 16:00 
Jesús Antonio Sánchez Antúnez24 Jun 2007 16:26 
Subject:Mako unicode problems.
From:jasa...@public.gmane.org (jasa@public.gmane.org)
Date:06/20/2007 08:13:53 PM
List:com.googlegroups.pylons-discuss

Hello guys, I'm trying to use mako with unicode, but I get the following error:

mako.exceptions.CompileException: Unicode decode operation of encoding 'utf-8' failed in file 'foo.txt' at line: 0 char: 0

I read the mako documentation and tried the following example:

# -*- coding: utf-8 -*-

from mako.template import Template from mako.lookup import TemplateLookup

def main(): mylookup = TemplateLookup(directories=["."]) mytemplate = mylookup.get_template("foo.txt") print mytemplate.render()

if __name__ == "__main__": main()

The foo.txt file is written as follows:

# -*- coding: utf-8 -*- Jesús Antonio

Any help will be very appreciated.