Context pane crashes with lyrics containing invalid unicode
Submitted by Mika Wahlroos
Link to original bug (#601171)
Description
The context pane plugin crashes Rhythmbox when attempting to display lyrics that contain invalid unicode characters.
Traceback (most recent call last): File "/usr/local/lib/rhythmbox/plugins/context/LyricsTab.py", line 128, in lyrics_ready stylesheet = self.styles) File "/usr/lib/python2.6/dist-packages/mako/template.py", line 133, in render return runtime.render(self, self.callable, args, data) File "/usr/lib/python2.6/dist-packages/mako/runtime.py", line 347, in _render render_context(template, callable, context, *args, **kwargs_for_callable(callable, data)) File "/usr/lib/python2.6/dist-packages/mako/runtime.py", line 364, in _render_context _exec_template(inherit, lclcontext, args=args, kwargs=kwargs) File "/usr/lib/python2.6/dist-packages/mako/runtime.py", line 397, in exec_template callable(context, *args, **kwargs) File "/tmp/context/usr/local/lib/rhythmbox/plugins/context/tmpl/lyrics-tmpl.html.py", line 41, in render_body __M_writer(unicode(lyrics)) UnicodeDecodeError: 'utf8' codec can't decode byte 0x92 in position 427: unexpected code byte
The code tries to turn the lyrics into a unicode object with unicode error checking enabled (which is the default behaviour for the function) but doesn't check for potential errors raised by the call.
The actual call is made by code generated from the template by the template system. I'm not very familiar with Mako templates but I guess the code would either need to convert the string to proper unicode before using it in the template, or somehow tell the template system not to use strict error checking.
Version: HEAD