Commit 9529ef06 authored by Sebastien Robin's avatar Sebastien Robin

some unicode error make sites unusable. Replace incorrect

utf-8 characters in order to give opportunity to fix them

git-svn-id: https://svn.erp5.org/repos/public/erp5/trunk@38992 20353a03-c40f-0410-a6d1-a30d3c3de9de
parent 3dab2927
......@@ -19,6 +19,8 @@
# FOR A PARTICULAR PURPOSE
##############################################################################
from zLOG import LOG
import sys
try:
from Products.PageTemplates.unicodeconflictresolver \
import PreferredCharsetResolver
......@@ -30,5 +32,11 @@ else:
# Since we use UTF-8 only in PageTemplate, it is enough here. It is
# faster than the original implementation, and it is compatible with
# requests that do not contain Accept-Charset header.
return unicode(text, 'utf-8', 'replace')
PreferredCharsetResolver.resolve = PreferredCharsetResolver_resolve
try:
result = unicode(text, 'utf-8')
except UnicodeDecodeError:
LOG('unicodeconflictresolver, Unicode Error', 0, text,
error=sys.exc_info())
result = unicode(text, 'utf-8', 'replace')
return result
PreferredCharsetResolver.resolve = PreferredCharsetResolver_resolv
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment