bug fix for search: hack for ISO8851 texts coming from IE

git-svn-id: svn://svn.cy55.de/Zope3/src/loops/trunk@2117 fd906abe-77d9-0310-91a1-e0d9ade77398
This commit is contained in:
helmutm 2007-10-17 14:23:25 +00:00
parent d0422a22ab
commit 71202469a2
2 changed files with 6 additions and 2 deletions

View file

@ -123,10 +123,14 @@ class SearchResults(BaseView):
form = self.request.form
type = form.get('search.1.text', 'loops:*')
text = form.get('search.2.text')
if text is not None:
text = util.toUnicode(text, encoding='ISO8859-15') # IE hack!!!
useTitle = form.get('search.2.title')
useFull = form.get('search.2.full')
conceptType = form.get('search.3.type', 'loops:concept:*')
conceptTitle = form.get('search.3.text')
if conceptTitle is not None:
conceptTitle = util.toUnicode(conceptTitle, encoding='ISO8859-15')
conceptUid = form.get('search.3.text_selected')
result = FullQuery(self).query(text=text, type=type,
useTitle=useTitle, useFull=useFull,

View file

@ -64,9 +64,9 @@ def nl2br(text):
else: # gracefully handle Mac line endings
return '<br />\n'.join(text.split('\r'))
def toUnicode(text):
def toUnicode(text, encoding='UTF-8'):
if type(text) is not unicode:
return text.decode('UTF-8')
return text.decode(encoding)
else:
return text