tablib: Import ascii characters not valid.
I tried to add data to the tablib Dataset. I use django import export to do so. Everything goes well with the data until it is in the dataset. Once it is added and I try to read the data I get the following error.
UnicodeEncodeError encountred while trying to read file: 'ascii' codec can't encode character u'\xc6' in position 241: ordinal not in range(128)
It is about the text Ævar. This name will fail when you try to read the data from the Dataset.
About this issue
- Original URL
- State: closed
- Created 8 years ago
- Comments: 18 (7 by maintainers)
Commits related to this issue
- Fix unicode encode errors on Python 2 -- Fixes #215 Switch csv library to backports.csv as the implementation is closer to the python 3 one. Add a test case covering the problem. Run tests with unico... — committed to founders4schools/tablib by deleted user 7 years ago
- Fix unicode encode errors on Python 2 -- Fixes #215 Switch csv library to backports.csv as the implementation is closer to the python 3 one. Add a test case covering the problem. Run tests with unico... — committed to founders4schools/tablib by deleted user 7 years ago
I’ve tried to look at your change on my pull request and I realised that tests were behaving quite differently in Python 2 and 3 because of the unicode literals, and I couldn’t use
u""notation on some python 3 versions.I’ve added the future import which resulted in the tests to pass on all Python 3 version, and failing in the same way on Python 2.6 and 2.7.
Then, I’ve implemented the changes suggested and a couple of others, and they all pass now. I even had to clean up some Python 2 specific code.