[IMP] tools mail: don't remove xml and doctype but remove encoding attribute
bzr revid: chm@openerp.com-20121219124038-05bf07960h05x0o8
This commit is contained in:
@@ -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. <br[ /]> -> \n, because otherwise the tree is obfuscated
|
||||
|
||||
Reference in New Issue
Block a user