From 63bf55d69fec57c554ef8f6e4333fced970c676d Mon Sep 17 00:00:00 2001 From: souliane Date: Wed, 12 Feb 2014 15:24:03 +0100 Subject: [PATCH] plugin XEP_0277: fix encode/decode errors --- src/plugins/plugin_xep_0277.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/plugin_xep_0277.py b/src/plugins/plugin_xep_0277.py index 58ff246b..7537bec9 100755 --- a/src/plugins/plugin_xep_0277.py +++ b/src/plugins/plugin_xep_0277.py @@ -218,13 +218,13 @@ class XEP_0277(object): 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: