# HG changeset patch # User souliane # Date 1392215043 -3600 # Node ID 8829a6c0b07002e553b0323c962416181b5ff7e2 # Parent eff944ff3e139c4d4f2b2a89317daca1abacc69c plugin XEP_0277: fix encode/decode errors diff -r eff944ff3e13 -r 8829a6c0b070 src/plugins/plugin_xep_0277.py --- a/src/plugins/plugin_xep_0277.py Wed Feb 12 15:23:15 2014 +0100 +++ b/src/plugins/plugin_xep_0277.py Wed Feb 12 15:24:03 2014 +0100 @@ -218,13 +218,13 @@ converted = yield synt.convert(data[attr], synt.getCurrentSyntax(profile), "XHTML") else: # clean the XHTML input converted = yield synt.clean_xhtml(data[attr]) - elem = elems[key](u'
%s
' % (NS_XHTML, converted)) + elem = elems[key]((u'
%s
' % (NS_XHTML, converted)).encode('utf-8')) elem.attrs['type'] = 'xhtml' if hasattr(_entry, '%s_xhtml' % key): raise exceptions.DataError(_("Can't have xhtml and rich content at the same time")) setattr(_entry, '%s_xhtml' % key, elem) else: # raw text only needs to be escaped to get HTML-safe sequence - elem = elems[key](escape(data[attr])) + elem = elems[key](escape(data[attr]).encode('utf-8')) elem.attrs['type'] = 'text' setattr(_entry, key, elem) if not getattr(_entry, key).text: