[PATCH 7/7] python: add missing conversions from and to utf-8
authorJustus Winter <4winter@informatik.uni-hamburg.de>
Wed, 14 Dec 2011 10:58:25 +0000 (11:58 +0100)
committerW. Trevor King <wking@tremily.us>
Fri, 7 Nov 2014 17:40:51 +0000 (09:40 -0800)
de/a19308af36183735a611a78c79fbe1d7456f3e [new file with mode: 0644]

diff --git a/de/a19308af36183735a611a78c79fbe1d7456f3e b/de/a19308af36183735a611a78c79fbe1d7456f3e
new file mode 100644 (file)
index 0000000..67defe8
--- /dev/null
@@ -0,0 +1,162 @@
+Return-Path: <teythoon@jade-hamburg.de>\r
+X-Original-To: notmuch@notmuchmail.org\r
+Delivered-To: notmuch@notmuchmail.org\r
+Received: from localhost (localhost [127.0.0.1])\r
+       by olra.theworths.org (Postfix) with ESMTP id 4FAD7429E47\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 02:59:30 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: 0\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=0 tagged_above=-999 required=5 tests=[none]\r
+       autolearn=disabled\r
+Received: from olra.theworths.org ([127.0.0.1])\r
+       by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
+       with ESMTP id jvh75MxL6G7m for <notmuch@notmuchmail.org>;\r
+       Wed, 14 Dec 2011 02:59:28 -0800 (PST)\r
+Received: from mail.cryptobitch.de (cryptobitch.de [88.198.7.68])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by olra.theworths.org (Postfix) with ESMTPS id 6B438429E4C\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 02:59:06 -0800 (PST)\r
+Received: from mail.jade-hamburg.de (unknown [85.183.11.228])\r
+       (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits))\r
+       (No client certificate requested)\r
+       by mail.cryptobitch.de (Postfix) with ESMTPSA id 1165550F614\r
+       for <notmuch@notmuchmail.org>; Wed, 14 Dec 2011 11:59:05 +0100 (CET)\r
+Received: by mail.jade-hamburg.de (Postfix, from userid 401)\r
+       id 8A389DF2A0; Wed, 14 Dec 2011 11:59:04 +0100 (CET)\r
+Received: from thinkbox.jade-hamburg.de (unknown [85.183.11.228])\r
+       (using TLSv1 with cipher AES256-SHA (256/256 bits))\r
+       (No client certificate requested) (Authenticated sender: teythoon)\r
+       by mail.jade-hamburg.de (Postfix) with ESMTPSA id 446BFDF2A6;\r
+       Wed, 14 Dec 2011 11:58:48 +0100 (CET)\r
+Received: from teythoon by thinkbox.jade-hamburg.de with local (Exim 4.77)\r
+       (envelope-from <teythoon@thinkbox.jade-hamburg.de>)\r
+       id 1RamXs-0004Mk-7d; Wed, 14 Dec 2011 11:58:44 +0100\r
+From: Justus Winter <4winter@informatik.uni-hamburg.de>\r
+To: notmuch@notmuchmail.org\r
+Subject: [PATCH 7/7] python: add missing conversions from and to utf-8\r
+Date: Wed, 14 Dec 2011 11:58:25 +0100\r
+Message-Id:\r
+ <1323860305-15802-8-git-send-email-4winter@informatik.uni-hamburg.de>\r
+X-Mailer: git-send-email 1.7.7.3\r
+In-Reply-To:\r
+ <1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
+References:\r
+ <1323860305-15802-1-git-send-email-4winter@informatik.uni-hamburg.de>\r
+X-BeenThere: notmuch@notmuchmail.org\r
+X-Mailman-Version: 2.1.13\r
+Precedence: list\r
+List-Id: "Use and development of the notmuch mail system."\r
+       <notmuch.notmuchmail.org>\r
+List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
+List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
+List-Post: <mailto:notmuch@notmuchmail.org>\r
+List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
+List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
+       <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
+X-List-Received-Date: Wed, 14 Dec 2011 10:59:31 -0000\r
+\r
+---\r
+ bindings/python/notmuch/database.py |    6 +++---\r
+ bindings/python/notmuch/filename.py |    2 +-\r
+ bindings/python/notmuch/message.py  |    8 ++++----\r
+ bindings/python/notmuch/thread.py   |    2 +-\r
+ 4 files changed, 9 insertions(+), 9 deletions(-)\r
+\r
+diff --git a/bindings/python/notmuch/database.py b/bindings/python/notmuch/database.py\r
+index 3f6e04d..2eae69e 100644\r
+--- a/bindings/python/notmuch/database.py\r
++++ b/bindings/python/notmuch/database.py\r
+@@ -430,7 +430,7 @@ class Database(object):\r
+                removed.\r
+         """\r
+         self._assert_db_is_initialized()\r
+-        return self._remove_message(self._db, filename)\r
++        return self._remove_message(self._db, _str(filename))\r
\r
+     def find_message(self, msgid):\r
+         """Returns a :class:`Message` as identified by its message ID\r
+@@ -933,9 +933,9 @@ class Filenames(object):\r
+             self._files_p = None\r
+             raise StopIteration\r
\r
+-        file = Filenames._get(self._files_p)\r
++        file_ = Filenames._get(self._files_p)\r
+         self._move_to_next(self._files_p)\r
+-        return file\r
++        return file_.decode('utf-8', errors='ignore')\r
+     next = __next__ # python2.x iterator protocol compatibility\r
\r
+     def __len__(self):\r
+diff --git a/bindings/python/notmuch/filename.py b/bindings/python/notmuch/filename.py\r
+index 969931a..0c2e0d5 100644\r
+--- a/bindings/python/notmuch/filename.py\r
++++ b/bindings/python/notmuch/filename.py\r
+@@ -93,7 +93,7 @@ class Filenames(Python3StringMixIn):\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
\r
+         while self._valid(self._files):\r
+-            yield Filenames._get(self._files)\r
++            yield Filenames._get(self._files).decode('utf-8', errors='ignore')\r
+             self._move_to_next(self._files)\r
\r
+         self._files = None\r
+diff --git a/bindings/python/notmuch/message.py b/bindings/python/notmuch/message.py\r
+index 955382d..245e814 100644\r
+--- a/bindings/python/notmuch/message.py\r
++++ b/bindings/python/notmuch/message.py\r
+@@ -338,7 +338,7 @@ class Message(Python3StringMixIn):\r
+         """\r
+         if self._msg is None:\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
+-        return Message._get_message_id(self._msg)\r
++        return Message._get_message_id(self._msg).decode('utf-8', errors='ignore')\r
\r
+     def get_thread_id(self):\r
+         """Returns the thread ID\r
+@@ -356,7 +356,7 @@ class Message(Python3StringMixIn):\r
+         if self._msg is None:\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
\r
+-        return Message._get_thread_id(self._msg)\r
++        return Message._get_thread_id(self._msg).decode('utf-8', errors='ignore')\r
\r
+     def get_replies(self):\r
+         """Gets all direct replies to this message as :class:`Messages`\r
+@@ -426,7 +426,7 @@ class Message(Python3StringMixIn):\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
\r
+         #Returns NULL if any error occurs.\r
+-        header = Message._get_header(self._msg, header)\r
++        header = Message._get_header(self._msg, _str(header))\r
+         if header == None:\r
+             raise NotmuchError(STATUS.NULL_POINTER)\r
+         return header.decode('UTF-8', errors='ignore')\r
+@@ -440,7 +440,7 @@ class Message(Python3StringMixIn):\r
+         """\r
+         if self._msg is None:\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
+-        return Message._get_filename(self._msg)\r
++        return Message._get_filename(self._msg).decode('utf-8', errors='ignore')\r
\r
+     def get_filenames(self):\r
+         """Get all filenames for the email corresponding to 'message'\r
+diff --git a/bindings/python/notmuch/thread.py b/bindings/python/notmuch/thread.py\r
+index 3912957..2ed7db0 100644\r
+--- a/bindings/python/notmuch/thread.py\r
++++ b/bindings/python/notmuch/thread.py\r
+@@ -246,7 +246,7 @@ class Thread(object):\r
+         """\r
+         if self._thread is None:\r
+             raise NotmuchError(STATUS.NOT_INITIALIZED)\r
+-        return Thread._get_thread_id(self._thread)\r
++        return Thread._get_thread_id(self._thread).decode('utf-8', errors='ignore')\r
\r
+     _get_total_messages = nmlib.notmuch_thread_get_total_messages\r
+     _get_total_messages.argtypes = [NotmuchThreadP]\r
+-- \r
+1.7.7.3\r
+\r