Encoding problem with web application (Paste+Mako)

Martin Skou msj at infoserv.dk
Wed Jun 6 05:00:04 EDT 2007


Rob Wolfe wrote:
> 
> You have to know the encoding of user input and then you
> can use ``input_encoding`` and ``output_encoding`` parameters
> of ``Template``. Mako internally handles everything as Python unicode
> objects.
> For example:
> 
> t = Template(filename="templ.mako", input_encoding="iso-8859-2",
>              output_encoding="iso-8859-2")
> content = t.render(**context)
> 
> --
> HTH,
> Rob
> 

Thanks Rob

Using:

t=Template(content,input_encoding="utf-8", output_encoding="utf-8")

did the trick. Thanks for the help.

/Martin



More information about the Python-list mailing list