Fixed encoding problems
bzr revid: nicolas.vanhoren@openerp.com-20120814121425-jq3ieebbsa7rcds5
This commit is contained in:
@@ -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()
|
||||
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user