diff --git a/openerp/tools/mail.py b/openerp/tools/mail.py index 9df7499d0c8..e6b471a26ba 100644 --- a/openerp/tools/mail.py +++ b/openerp/tools/mail.py @@ -135,8 +135,8 @@ def html_email_clean(html): html = ustr(html) - # 0. remove doctype and xml tags - doctype = re.compile(r"(<[?]xml.*?[?]>|<[!]DOCTYPE.*?>)[\n\r\s]*", re.IGNORECASE | re.DOTALL) + # 0. remove encoding attribute inside tags + doctype = re.compile(r'(<[^>]*\s)(encoding=(["\'][^"\']*?["\']|[^\s\n\r>]+)(\s[^>]*|/)?>)', re.IGNORECASE | re.DOTALL) html = doctype.sub(r"", html) # 1. -> \n, because otherwise the tree is obfuscated