ducky64 / labelmaker

Labelmaker using SVG templates and CSV data
GNU General Public License v2.0
9 stars 5 forks source link

Cyrylic not supported #6

Open zeridon opened 8 years ago

zeridon commented 8 years ago

Hello,

Just stumbled on this and seemed quite useful, but it does not support cyrilyc (although it should by the looks of it)

Traceback (most recent call last):
  File "labelmaker.py", line 133, in <module>
    for row in data_reader:
  File "/usr/lib/python2.7/csv.py", line 104, in next
    row = self.reader.next()
UnicodeEncodeError: 'ascii' codec can't encode characters in position 4-7: ordinal not in range(128)
labelmaker$ pip freeze
Pillow==3.2.0
argparse==1.2.1
configparser==3.5.0
wsgiref==0.1.2

attached samples

tst.zip

zeridon commented 8 years ago

The issue seems to stem because of csv module not being unicode (at least in python 2.7). There are some recomendations for a workaround (https://docs.python.org/2/library/csv.html#csv-examples)

ducky64 commented 8 years ago

Does it work on Python 3? The code was written for Python 3, that anything works under Python 2.x is just luck...

zeridon commented 8 years ago

With python3 it works fine.

Indeed the issue is that the csv module is not unicode ready. Short solution (python2 specific) is to set default encoding (which is not good per se)