From 71202469a2bdcad3857fe53ae76d50d701568871 Mon Sep 17 00:00:00 2001 From: helmutm Date: Wed, 17 Oct 2007 14:23:25 +0000 Subject: [PATCH] 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 --- search/browser.py | 4 ++++ util.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/search/browser.py b/search/browser.py index 6c15bab..3ae7a4b 100644 --- a/search/browser.py +++ b/search/browser.py @@ -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, diff --git a/util.py b/util.py index b3ffe4e..43da7de 100644 --- a/util.py +++ b/util.py @@ -64,9 +64,9 @@ def nl2br(text): else: # gracefully handle Mac line endings return '
\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