--- /dev/null
+Return-Path: <gregor@sam.mediasupervision.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 5417B431FBC\r
+ for <notmuch@notmuchmail.org>; Thu, 4 Mar 2010 02:48:12 -0800 (PST)\r
+X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
+X-Spam-Flag: NO\r
+X-Spam-Score: -0.563\r
+X-Spam-Level: \r
+X-Spam-Status: No, score=-0.563 tagged_above=-999 required=5\r
+ tests=[AWL=-0.564, BAYES_50=0.001] autolearn=ham\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 8jDghtYnl3Mz for <notmuch@notmuchmail.org>;\r
+ Thu, 4 Mar 2010 02:48:11 -0800 (PST)\r
+X-Greylist: delayed 476 seconds by postgrey-1.32 at olra;\r
+ Thu, 04 Mar 2010 02:48:11 PST\r
+Received: from sam.mediasupervision.de (sam.mediasupervision.de\r
+ [80.152.3.104]) by olra.theworths.org (Postfix) with ESMTP id 99368431FAE for\r
+ <notmuch@notmuchmail.org>; Thu, 4 Mar 2010 02:48:11 -0800 (PST)\r
+Received: from localhost (sam.mediasupervision.de [127.0.0.1])\r
+ by sam.mediasupervision.de (Postfix) with ESMTP id 3DE13486291\r
+ for <notmuch@notmuchmail.org>; Thu, 4 Mar 2010 11:40:04 +0100 (CET)\r
+X-Virus-Scanned: Debian amavisd-new at sam.mediasupervision.de\r
+Received: from sam.mediasupervision.de ([127.0.0.1])\r
+ by localhost (sam.mediasupervision.de [127.0.0.1]) (amavisd-new,\r
+ port 10024) with ESMTP id 1EgDPjribO5e for <notmuch@notmuchmail.org>;\r
+ Thu, 4 Mar 2010 11:40:04 +0100 (CET)\r
+Received: by sam.mediasupervision.de (Postfix, from userid 1000)\r
+ id D5E20486292; Thu, 4 Mar 2010 11:40:03 +0100 (CET)\r
+Content-Type: text/plain; charset=UTF-8\r
+From: Gregor Hoffleit <gregor@hoffleit.de>\r
+To: notmuch <notmuch@notmuchmail.org>\r
+Date: Thu, 04 Mar 2010 11:40:03 +0100\r
+Message-Id: <1267697893-sup-4538@sam.mediasupervision.de>\r
+User-Agent: Sup/git\r
+Content-Transfer-Encoding: 8bit\r
+Subject: [notmuch] [PATCH] json_quote_str should handle non-ASCII characters\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: Thu, 04 Mar 2010 10:48:12 -0000\r
+\r
+The current code in json_quote_str() only accepts strict printable ASCII\r
+code points (i.e. 32-127), all other code points are dropped from the\r
+JSON output.\r
+\r
+This patch accepts code points 32-255.\r
+\r
+json_quote_str() should handle non-ASCII characters.\r
+---\r
+ json.c | 4 ++--\r
+ 1 files changed, 2 insertions(+), 2 deletions(-)\r
+\r
+diff --git a/json.c b/json.c\r
+index 9614143..6dc0345 100644\r
+--- a/json.c\r
++++ b/json.c\r
+@@ -59,7 +59,7 @@ json_quote_str(const void *ctx, const char *str)\r
+ return NULL;\r
+ \r
+ for (ptr = str; *ptr; len++, ptr++) {\r
+- if (*ptr < 32 || *ptr == '\"' || *ptr == '\\')\r
++ if ((unsigned char)(*ptr) < 32 || *ptr == '\"' || *ptr == '\\')\r
+ len++;\r
+ }\r
+ \r
+@@ -70,7 +70,7 @@ json_quote_str(const void *ctx, const char *str)\r
+ \r
+ *ptr2++ = '\"';\r
+ while (*ptr) {\r
+- if (*ptr > 31 && *ptr != '\"' && *ptr != '\\') {\r
++ if ((unsigned char)(*ptr) > 31 && *ptr != '\"' && *ptr != '\\') {\r
+ *ptr2++ = *ptr++;\r
+ } else {\r
+ *ptr2++ = '\\';\r
+--\r
+1.7.0\r