diff --git a/openerp/tests/test_html_sanitize.py b/openerp/tests/test_html_sanitize.py index 85001996ee1..90ccc88cc1d 100755 --- a/openerp/tests/test_html_sanitize.py +++ b/openerp/tests/test_html_sanitize.py @@ -1,4 +1,5 @@ #!/usr/bin/env python +# -*- coding: utf-8 -*- import unittest from openerp.tools.html_sanitize import html_sanitize @@ -28,6 +29,9 @@ class TestSanitizer(unittest.TestCase): def test_test_case(self): html_sanitize(test_case) + + def test_crm(self): + html_sanitize("Merci à l'intérêt pour notre produit.nous vous contacterons bientôt. Merci") if __name__ == '__main__': unittest.main() \ No newline at end of file diff --git a/openerp/tools/html_sanitize.py b/openerp/tools/html_sanitize.py index e8896774dc1..5164ceb276e 100644 --- a/openerp/tools/html_sanitize.py +++ b/openerp/tools/html_sanitize.py @@ -6,6 +6,8 @@ def html_sanitize(x): if not x: return x root = pq("
") + if type(x) == str: + x = unicode(x, "utf8", "replace") root.html(x) result = handle_element(root[0]) new = pq(result)