[FIX] note: small bugs
authorDesai Binjal <dbi@openerp.com>
Wed, 6 Aug 2014 12:16:46 +0000 (17:46 +0530)
committerRichard Mathot <rim@openerp.com>
Thu, 21 Aug 2014 13:55:23 +0000 (15:55 +0200)
addons/pad/pad.py
openerp/tools/mail.py

index 0a72e2a..1379e06 100644 (file)
@@ -57,7 +57,7 @@ class pad_common(osv.osv_memory):
             #get content of the real field
             for record in model.browse(cr, uid, [context["object_id"]]):
                 if record[real_field]:
-                    myPad.setText(path, html2plaintext(record[real_field]))
+                    myPad.setText(path, (html2plaintext(record[real_field]).encode('utf-8')))
                     #Etherpad for html not functional
                     #myPad.setHTML(path, record[real_field])
 
index 425a7ff..fdcb44e 100644 (file)
@@ -213,6 +213,7 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
     html = html.replace(' ' * 2, ' ')
     html = html.replace('&gt;', '>')
     html = html.replace('&lt;', '<')
+    html = html.replace('&amp;', '&')
 
     # strip all lines
     html = '\n'.join([x.strip() for x in html.splitlines()])
@@ -375,4 +376,4 @@ def email_split(text):
                 # sometimes returns emails without at least '@'. The '@'
                 # is strictly required in RFC2822's `addr-spec`.
                 if addr[1]
-                if '@' in addr[1]]
\ No newline at end of file
+                if '@' in addr[1]]