chartit / django-chartit

A Django app to plot charts and pivot charts directly from the models. Uses HighCharts and jQuery JavaScript libraries to render the charts on the webpage.
http://django-chartit.mrsenko.com/
Other
492 stars 166 forks source link

Unicode errors #5

Closed marshalc closed 8 years ago

marshalc commented 12 years ago

I'm getting "UnicodeEncodeError" from chartit.

'ascii' codec can't encode character u'\u2013' in position 33: ordinal not in range(128) Django Version: 1.4 Exception Type: UnicodeEncodeError Exception Value:
'ascii' codec can't encode character u'\u2013' in position 33: ordinal not in range(128) Exception Location: /lib/python2.6/site-packages/chartit/chartdata.py in _get_data, line 525 Python Version: 2.6.5

This specifically seems related to "lv = tuple(map(str, lv))", when "lv" contains an en-dash. I suspect I'll get even more of these errors on my data since I can't reasonably force all of my data into ASCII.

Hopefully you can check your code over for this and related issues. If I have the time, I'll try and fix this and send my solution on, but for now I'm forced to work around this.

okainov commented 8 years ago

Looks like fix is kinda simple: replace line 531 from chartdata.py lv = tuple(map(str, lv)) to lv = tuple(map(unicode, lv))