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

UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position ordinal not in range(128) #39

Closed
sidvishnoi opened this issue Dec 19, 2016 · 2 comments

Comments

@sidvishnoi
Copy link

In python interpreter,

>>> import mdv
>>> st = '''
... | Item     | Value | Qty   |
... |  --- | --- | --- |
... | Computer | $1600 |  5    |
... | Phone    | $12   |  12   |
... | Pipe     | $1    |  234  |
... '''
>>> print mdv.main(st)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/local/lib/python2.7/dist-packages/mdv/markdownviewer.py", line 1063, in main
    the_html = MD.convert(md)
  File "/usr/local/lib/python2.7/dist-packages/markdown/__init__.py", line 375, in convert
    newRoot = treeprocessor.run(root)
  File "/usr/local/lib/python2.7/dist-packages/mdv/markdownviewer.py", line 873, in run
    formatter(doc, out)
  File "/usr/local/lib/python2.7/dist-packages/mdv/markdownviewer.py", line 868, in formatter
    formatter(c, out, hir + 1, parent=el)
  File "/usr/local/lib/python2.7/dist-packages/mdv/markdownviewer.py", line 830, in formatter
    borders(t)
  File "/usr/local/lib/python2.7/dist-packages/mdv/markdownviewer.py", line 805, in borders
    t[0] = t[-1] = low(t[0].replace('-', '─'))
UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position 0: ordinal not in range(128)

Whereas if I save the above markdown in a file, and

$ mdv file.md

it works fine

@axgkl
Copy link
Member

axgkl commented Dec 19, 2016

hi,
are you ok if I change the defaultencoding to utf-8 also when used as a lib?

It will change your defaultencoding to utf-8. Which is harmless (and they are about to do it in Py3 now as well)

@axgkl
Copy link
Member

axgkl commented Dec 19, 2016

without expecting your answer I just did it.

c040aaa

-> try again, will work now, repoen if not.

thanks,
G.

@axgkl axgkl closed this as completed Dec 19, 2016
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