cenkalti / pyhtml

HTML generation library for Python
Other
72 stars 10 forks source link

Add support for unicode(tag) #1

Closed ghost closed 11 years ago

ghost commented 11 years ago

Previously, calling unicode() on a tag with non-ascii characters would result in a UnicodeDecodeError.

With this commit, there is still some implicit str-to-unicode conversion going on during rendering because literals are in str rather than unicode, but unlike render(), there's no mandatory utf-8 encoding and we keep our unicode values unencoded.

This allows us, for example, to directly supply PyHTML tag to Django templates without having to explicitly call tag.render().decode('utf-8')

cenkalti commented 11 years ago

Great! Thanks for the pull request.