> I'm trying to use Unicode in PTL templates, like this: > > def foo[html](self): > get_response().set_charset('utf8') > u'\N{INFINITY}' > TypeError: encode() argument 1 must be string, not htmltext In addition to what David has said, you've also highlighted a common trap - if you have a callable which is expecting a str, and you are quoting a string literal, you need to force it like so: str('utf8') otherwise ptl will convert the str to htmltext on you. I usually set hard coded strings like that to a constant outside the ptl function or method to avoid litering the code with str().