changeset 838:8829a6c0b070

plugin XEP_0277: fix encode/decode errors
author souliane <souliane@mailoo.org>
date Wed, 12 Feb 2014 15:24:03 +0100
parents eff944ff3e13
children f8681a7fd834
files src/plugins/plugin_xep_0277.py
diffstat 1 files changed, 2 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- 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'<div xmlns="%s">%s</div>' % (NS_XHTML, converted))
+                        elem = elems[key]((u'<div xmlns="%s">%s</div>' % (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: