Fixed encoding problems

bzr revid: nicolas.vanhoren@openerp.com-20120814121425-jq3ieebbsa7rcds5
This commit is contained in:
niv-openerp 2012-08-14 14:14:25 +02:00
parent f111a51f10
commit 63ae87fb4c
2 changed files with 6 additions and 0 deletions

View File

@ -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()

View File

@ -6,6 +6,8 @@ def html_sanitize(x):
if not x:
return x
root = pq("<div />")
if type(x) == str:
x = unicode(x, "utf8", "replace")
root.html(x)
result = handle_element(root[0])
new = pq(result)