python-tablefu icon indicating copy to clipboard operation
python-tablefu copied to clipboard

UnicodeEncodeError

Open simonpa71 opened this issue 10 years ago • 1 comments

I am using tablefu + jinja2 to create html forms from an excel spreadsheet. Excel 2013 will export csv with 8bit ASCII, Latin-1, which allows for translations into European languages. Tablefu is based on the csv reader that does not natively support >128 ASCII or unicode, and jinja only wants unicode, so I get UnicodeEncodeError. However the help page http://docs.python.org/2/library/csv.html#examples does have an implemention for unicode. I pasted the example generator into init.py and added an "encoding" option, to replace reader = unicode_csv_reader, replaced open with codecs.open, et voilà, my tables and html can contain Latin-1.

simonpa71 avatar Mar 28 '14 00:03 simonpa71

Thanks for the heads up. Care to package this fix into a pull request?

eyeseast avatar Mar 28 '14 13:03 eyeseast