[FIX] Solve some mail issues which are currently present in 7.0
[odoo/odoo.git] / openerp / tools / mail.py
index 1f3e9c1..7e2c798 100644 (file)
@@ -211,10 +211,11 @@ def html2plaintext(html, body_id=None, encoding='utf-8'):
     html = re.sub('<br\s*/?>', '\n', html)
     html = re.sub('<.*?>', ' ', html)
     html = html.replace(' ' * 2, ' ')
+    html = html.replace('&gt;', '>')
+    html = html.replace('&lt;', '<')
 
     # strip all lines
-    html = '\n'.join([x.strip() for x in html.splitlines()])
-    html = html.replace('\n' * 2, '\n')
+    html = ''.join([x.strip() for x in html.splitlines(True)])
 
     for i, url in enumerate(url_index):
         if i == 0: