Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unicode errors in a "pre." block #43

Closed
adam-iris opened this issue May 30, 2017 · 1 comment
Closed

Unicode errors in a "pre." block #43

adam-iris opened this issue May 30, 2017 · 1 comment

Comments

@adam-iris
Copy link

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
Copy link
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants