Back to index

plone3  3.1.7
unicodeconflictresolver.py
Go to the documentation of this file.
00001 from zope.interface import implements
00002 from Products.PageTemplates.interfaces import IUnicodeEncodingConflictResolver
00003 
00004 from Products.CMFPlone.patches.unicodehacks import _unicode_replace
00005 
00006 
00007 class UTF8EncodingConflictResolver(object):
00008     """This resolver tries to decode a string from utf-8 and replaces it
00009        otherwise but logs a warning.
00010     """
00011 
00012     implements(IUnicodeEncodingConflictResolver)
00013 
00014     def resolve(self, context, text, expression):
00015         return _unicode_replace(text)
00016 
00017 UTF8EncodingConflictResolver = UTF8EncodingConflictResolver()