Public bug reported:
When using DateFormatter with umlauts in month names, a
UnicodeDecodeError is raised:
months_formatter = matplotlib.dates.DateFormatter('%b')
axes.xaxis.set_major_formatter(months_formatter)
and the German month name "März" lead to
Traceback (most recent call last):
...
File "/home/chantal/chantal/kicker/views.py", line 264, in update_plot
canvas.print_figure(os.path.join(path, "kicker.png"))
File "/usr/lib/pymodules/python2.6/matplotlib/backend_bases.py", line
1476,
in print_figure
**kwargs)
File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line
358, in print_png
FigureCanvasAgg.draw(self)
File "/usr/lib/pymodules/python2.6/matplotlib/backends/backend_agg.py",
line
314, in draw
self.figure.draw(self.renderer)
File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in
draw_wrapper
draw(artist, renderer, *kl)
File "/usr/lib/pymodules/python2.6/matplotlib/figure.py", line 773, in
draw
for a in self.axes: a.draw(renderer)
File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in
draw_wrapper
draw(artist, renderer, *kl)
File "/usr/lib/pymodules/python2.6/matplotlib/axes.py", line 1735, in draw
a.draw(renderer)
File "/usr/lib/pymodules/python2.6/matplotlib/artist.py", line 46, in
draw_wrapper
draw(artist, renderer, *kl)
File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 736, in draw
for tick, loc, label in self.iter_ticks():
File "/usr/lib/pymodules/python2.6/matplotlib/axis.py", line 680, in
iter_ticks
majorLabels = [self.major.formatter(val, i) for i, val in
enumerate(majorLocs)]
File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 294, in
__call__
return self.strftime(dt, self.fmt)
File "/usr/lib/pymodules/python2.6/matplotlib/dates.py", line 320, in
strftime
return cbook.unicode_safe(dt.strftime(fmt))
File "/usr/lib/pymodules/python2.6/matplotlib/cbook.py", line 28, in
unicode_safe
else: return unicode(s, preferredencoding)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 1:
ordinal
not in range(128)
By the way, the month name is also truncated to "M??r" because the "ä"
takes two bytes, prolonging the month name by one byte.
** Affects: matplotlib (Ubuntu)
Importance: Undecided
Status: New
--
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/697113
Title:
DateFormatter and i18n raises UnicodeDecodeError
--
ubuntu-bugs mailing list
[email protected]
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs