pyjade
pyjade copied to clipboard
Error with unicode character - python 2.7
I had the following line of code, that caused my template to throw an error:
error 'ascii' codec can't encode characters in position...
Line throwing an error:
meta(property="og:description", content="#{post.tldr}")
which could be fixed by
meta(property="og:description", content!="{{post.tldr}}")
Is this expected behavior? post.tldr is a unicode string.
I believe this is caused by __pyjade_attrs using str literals instead of unicode.
This problem may appear again because __pyjade_attrs calls escape which fallbacks to str instead of unicode:
https://github.com/syrusakbary/pyjade/blob/cc886e24986c08a3dacae2df2343197d3ab6bd0d/pyjade/runtime.py#L40