unicode decode error with UnicodeOption

This commit is contained in:
Emmanuel Garette 2017-02-02 08:56:01 +01:00
parent 2db15e193e
commit 1fba3394fe

View File

@ -30,8 +30,15 @@ def display_list(lst, separator='and'):
else: else:
lst_ = [] lst_ = []
for l in lst[:-1]: for l in lst[:-1]:
lst_.append(str(l)) if isinstance(l, unicode):
return ', '.join(lst_) + _(' {} ').format(separator) + str(lst[-1]) l = l.encode('utf8')
elif not isinstance(l, str):
l = str(l)
lst_.append(l)
last = lst[-1]
if isinstance(last, unicode):
last = last.encode('utf8')
return ', '.join(lst_) + _(' {} ').format(separator) + last
# Exceptions for an Option # Exceptions for an Option