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.