UnicodeDecodeError: 'ascii' codec can't decode byte 0xe2 in position ordinal not in range(128)
Closed this issue · 2 comments
sidvishnoi commented
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 commented
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)