django-tablib
django-tablib copied to clipboard
UnicodeDecodeError
Hello @joshourisman . Thx for django-tablib :).
I'm getting an UnicodeDecodeError when generating HTML table. I have hacked a bit and here is what I found.
On https://github.com/joshourisman/django-tablib/blob/master/django_tablib/views.py#L20 when using hasattr you hide any exception that can happen in rendering of table, if you change to getattr this exceptions raise to developer. It's better to know where the problem of getting a 404 is :]. However, isn't better just keep a suported formats list or is intentional to render at this time?
After I have changed that line to use getattr I finally saw that at https://github.com/joshourisman/django-tablib/blob/master/django_tablib/base.py#L40 the BaseDaaset()._cleanval(value, str) encode the value in 'utf-8'. This is working for XLS an CSV tables, but not for HTML. I have checked that this value is unicode when enter in _cleanval method.
The data that is giving me headcache for you use in tests is:
Rua Maracá
Ap 4231
I'm sure that you can test with any accentuated character :).
[]'s