FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Unicode errors in a "pre." block · Issue #43 · textile/python-textile · GitHub

Unicode errors in a "pre." block #43

Description

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions


    Back | FazBrowse Home | New Git URL