pyjade icon indicating copy to clipboard operation
pyjade copied to clipboard

Error with unicode character - python 2.7

Open mathisonian opened this issue 12 years ago • 2 comments

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.

mathisonian avatar Apr 15 '13 19:04 mathisonian

I believe this is caused by __pyjade_attrs using str literals instead of unicode.

xiaq avatar May 13 '13 10:05 xiaq

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

huiyiqun avatar Jul 27 '15 09:07 huiyiqun