Skip to content

Commit

Permalink
Fix Plone 5 encoding test
Browse files Browse the repository at this point in the history
  • Loading branch information
rodfersou committed Oct 16, 2018
1 parent f6255b0 commit f376249
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/collective/cover/tiles/richtext.py
Expand Up @@ -12,6 +12,7 @@
from plone.tiles.interfaces import ITileDataManager
from plone.uuid.interfaces import IUUID
from Products.CMFPlone.utils import safe_hasattr
from Products.CMFPlone.utils import safe_unicode
from Products.Five.browser.pagetemplatefile import ViewPageTemplateFile
from zope import schema
from zope.interface import implementer
Expand Down Expand Up @@ -93,10 +94,10 @@ def SearchableText(self):
transforms = api.portal.get_tool('portal_transforms')
data = transforms.convertTo(
'text/plain',
value.encode('utf-8 ') if isinstance(value, six.text_type) else value.raw_encoded,
value.raw_encoded,
mimetype='text/html',
context=context,
encoding='utf-8' if isinstance(value, six.text_type) else value.encoding)
encoding=value.encoding)

searchable_text = six.text_type(data.getData(), 'utf-8')
searchable_text = safe_unicode(data.getData()).encode('utf-8')
return searchable_text.strip() # remove leading and trailing spaces

0 comments on commit f376249

Please sign in to comment.