From 594eef856ba5b449b78f85437c850880cb359237 Mon Sep 17 00:00:00 2001 From: Xeric Date: Mon, 21 Jan 2019 18:02:25 +0800 Subject: [PATCH] [issue/1] fix issue for display content with some special unicode chars --- info.plist | 4 ++-- main.py | 10 +++++----- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/info.plist b/info.plist index bc4ba17..120b58c 100644 --- a/info.plist +++ b/info.plist @@ -408,8 +408,8 @@ Mail content search is based on preview content, not full text of mail, so will version - 0.0.6 + 0.0.7 webaddress - + https://github.com/xeric/alfred-outlook diff --git a/main.py b/main.py index 65608d1..e8b56e8 100644 --- a/main.py +++ b/main.py @@ -25,11 +25,11 @@ def main(wf): query = wf.decode(sys.argv[1]) - handle(query) + handle(wf, query) log.info('searching mail with keyword') -def handle(query): +def handle(wf, query): if (len(query) < 3): wf.add_item(title='Type more characters to serach...', subtitle='too less characters will lead huge irrelevant results', @@ -49,7 +49,7 @@ def handle(query): page = 0 if m is None else int(m.group(1)) if page: query = query.replace('|' + str(page), '') - log.info("query string is: " + unicode(query)) + log.info("query string is: " + query) log.info("query page is: " + str(page)) searchType = 'All' @@ -86,12 +86,12 @@ def handle(query): searchMethod = getattr(sys.modules[__name__], 'query' + searchType) searchMethod(cur, keywords, offset, calculatedPageSize, folder) - if cur.rowcount: + if cur.rowcount: for row in cur: log.info(row[0]) path = outlookData + row[3] if row[2]: - content = row[2].encode('ascii', 'ignore').decode('ascii') + content = wf.decode(row[2]) content = content.replace('\r\n', " ") else: content = "no content preview"