ickc / pantable

CSV Tables in Markdown: Pandoc Filter for CSV Tables
https://ickc.github.io/pantable/
BSD 3-Clause "New" or "Revised" License
86 stars 15 forks source link

Problems with encoding for column width calculation #13

Closed fidelaznar closed 7 years ago

fidelaznar commented 7 years ago

The following table could not be compiled:

---
caption: 'Áreas ...'
alignment: LLL
table-width: 2/3
markdown: True
---
Código,Áreas,N.Horas
DS, Discrete Structures, 43

Solution: force UTF8 encoding. Add in line 60 of "pantable.py" the following lines: reload(sys) sys.setdefaultencoding('utf8')

ickc commented 7 years ago

@fidelaznar, which Python version were you using?

fidelaznar commented 7 years ago

Python 2.7.13

ickc commented 7 years ago

It is a problem of the CSV module in Python2. Are you sure your fix would fix the unicode problem in Pyhton2?

I'm considering using another CSV writer/reader such as Pandas (for various reasons including performance and this). But it's a big dependency. Let me know your opinion on this.

fidelaznar commented 7 years ago

With this lines I've compiled a lot of tables without a problem using Unicode Chars. If the input is Unicode It should work.

ickc commented 7 years ago

Also see #21

ickc commented 7 years ago

@fidelaznar, please check pantable v0.11 in #25 fixes your problem. Thanks.