Unicode errors in a "pre." block
adam-iris opened this issue · 1 comments
adam-iris commented
Textile throws an error with:
textile.textile(u'pre. smart ‘quotes’ are not smart!')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "/workspace/anaconda/envs/django/lib/python2.7/site-packages/textile/core.py", line 1366, in textile
return Textile(html_type=html_type).parse(text)
File "/workspace/anaconda/envs/django/lib/python2.7/site-packages/textile/core.py", line 250, in parse
text = self.block(text)
File "/workspace/anaconda/envs/django/lib/python2.7/site-packages/textile/core.py", line 450, in block
block = Block(self, **match.groupdict())
File "/workspace/anaconda/envs/django/lib/python2.7/site-packages/textile/objects/block.py", line 29, in __init__
self.process()
File "/workspace/anaconda/envs/django/lib/python2.7/site-packages/textile/objects/block.py", line 104, in process
content = '{0}\n'.format(content)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2018' in position 6: ordinal not in range(128)
I found that adding
from __future__ import unicode_literals
to the top of block.py
fixed this issue.
ikirudennis commented
Thanks again for your pull request. It helped me rethink my approach to #37 and led to closing it as well.
Very much appreciated, and I hope the pull request wasn't done out of frustration over my introducing errors and being slow to fix them.