Decode strings to unicode before slicing (bug 1277)

Simplified fix; based on a patch by Justin Forest.

(merged from the gPodder 2.x branch)
This commit is contained in:
Thomas Perl 2011-02-28 20:28:13 +01:00
parent e846a37555
commit 65cb840771
1 changed files with 3 additions and 0 deletions

View File

@ -340,6 +340,9 @@ class PodcastEpisode(PodcastModelObject):
if not desc:
return _('No description available')
else:
# Decode the description to avoid gPodder bug 1277
if isinstance(desc, str):
desc = desc.decode('utf-8', 'ignore')
if len(desc) > MAX_LINE_LENGTH:
return desc[:MAX_LINE_LENGTH] + '...'
else: