Re: [PATCH 0/4] Allow specifying alternate names for addresses in other_email
[notmuch-archives.git] / 32 / 472c04e6dbbf99ec6bca70a3b6e4da970cc9eb
1 Return-Path: <gregor@sam.mediasupervision.de>\r
2 X-Original-To: notmuch@notmuchmail.org\r
3 Delivered-To: notmuch@notmuchmail.org\r
4 Received: from localhost (localhost [127.0.0.1])\r
5         by olra.theworths.org (Postfix) with ESMTP id 5417B431FBC\r
6         for <notmuch@notmuchmail.org>; Thu,  4 Mar 2010 02:48:12 -0800 (PST)\r
7 X-Virus-Scanned: Debian amavisd-new at olra.theworths.org\r
8 X-Spam-Flag: NO\r
9 X-Spam-Score: -0.563\r
10 X-Spam-Level: \r
11 X-Spam-Status: No, score=-0.563 tagged_above=-999 required=5\r
12         tests=[AWL=-0.564, BAYES_50=0.001] autolearn=ham\r
13 Received: from olra.theworths.org ([127.0.0.1])\r
14         by localhost (olra.theworths.org [127.0.0.1]) (amavisd-new, port 10024)\r
15         with ESMTP id 8jDghtYnl3Mz for <notmuch@notmuchmail.org>;\r
16         Thu,  4 Mar 2010 02:48:11 -0800 (PST)\r
17 X-Greylist: delayed 476 seconds by postgrey-1.32 at olra;\r
18         Thu, 04 Mar 2010 02:48:11 PST\r
19 Received: from sam.mediasupervision.de (sam.mediasupervision.de\r
20  [80.152.3.104])        by olra.theworths.org (Postfix) with ESMTP id 99368431FAE       for\r
21  <notmuch@notmuchmail.org>; Thu,  4 Mar 2010 02:48:11 -0800 (PST)\r
22 Received: from localhost (sam.mediasupervision.de [127.0.0.1])\r
23         by sam.mediasupervision.de (Postfix) with ESMTP id 3DE13486291\r
24         for <notmuch@notmuchmail.org>; Thu,  4 Mar 2010 11:40:04 +0100 (CET)\r
25 X-Virus-Scanned: Debian amavisd-new at sam.mediasupervision.de\r
26 Received: from sam.mediasupervision.de ([127.0.0.1])\r
27         by localhost (sam.mediasupervision.de [127.0.0.1]) (amavisd-new,\r
28         port 10024) with ESMTP id 1EgDPjribO5e for <notmuch@notmuchmail.org>;\r
29         Thu,  4 Mar 2010 11:40:04 +0100 (CET)\r
30 Received: by sam.mediasupervision.de (Postfix, from userid 1000)\r
31         id D5E20486292; Thu,  4 Mar 2010 11:40:03 +0100 (CET)\r
32 Content-Type: text/plain; charset=UTF-8\r
33 From: Gregor Hoffleit <gregor@hoffleit.de>\r
34 To: notmuch <notmuch@notmuchmail.org>\r
35 Date: Thu, 04 Mar 2010 11:40:03 +0100\r
36 Message-Id: <1267697893-sup-4538@sam.mediasupervision.de>\r
37 User-Agent: Sup/git\r
38 Content-Transfer-Encoding: 8bit\r
39 Subject: [notmuch] [PATCH] json_quote_str should handle non-ASCII characters\r
40 X-BeenThere: notmuch@notmuchmail.org\r
41 X-Mailman-Version: 2.1.13\r
42 Precedence: list\r
43 List-Id: "Use and development of the notmuch mail system."\r
44         <notmuch.notmuchmail.org>\r
45 List-Unsubscribe: <http://notmuchmail.org/mailman/options/notmuch>,\r
46         <mailto:notmuch-request@notmuchmail.org?subject=unsubscribe>\r
47 List-Archive: <http://notmuchmail.org/pipermail/notmuch>\r
48 List-Post: <mailto:notmuch@notmuchmail.org>\r
49 List-Help: <mailto:notmuch-request@notmuchmail.org?subject=help>\r
50 List-Subscribe: <http://notmuchmail.org/mailman/listinfo/notmuch>,\r
51         <mailto:notmuch-request@notmuchmail.org?subject=subscribe>\r
52 X-List-Received-Date: Thu, 04 Mar 2010 10:48:12 -0000\r
53 \r
54 The current code in json_quote_str() only accepts strict printable ASCII\r
55 code points (i.e. 32-127), all other code points are dropped from the\r
56 JSON output.\r
57 \r
58 This patch accepts code points 32-255.\r
59 \r
60 json_quote_str() should handle non-ASCII characters.\r
61 ---\r
62  json.c |    4 ++--\r
63   1 files changed, 2 insertions(+), 2 deletions(-)\r
64 \r
65 diff --git a/json.c b/json.c\r
66 index 9614143..6dc0345 100644\r
67 --- a/json.c\r
68 +++ b/json.c\r
69 @@ -59,7 +59,7 @@ json_quote_str(const void *ctx, const char *str)\r
70         return NULL;\r
71  \r
72      for (ptr = str; *ptr; len++, ptr++) {\r
73 -       if (*ptr < 32 || *ptr == '\"' || *ptr == '\\')\r
74 +       if ((unsigned char)(*ptr) < 32 || *ptr == '\"' || *ptr == '\\')\r
75             len++;\r
76      }\r
77  \r
78 @@ -70,7 +70,7 @@ json_quote_str(const void *ctx, const char *str)\r
79  \r
80      *ptr2++ = '\"';\r
81      while (*ptr) {\r
82 -           if (*ptr > 31 && *ptr != '\"' && *ptr != '\\') {\r
83 +           if ((unsigned char)(*ptr) > 31 && *ptr != '\"' && *ptr != '\\') {\r
84                 *ptr2++ = *ptr++;\r
85             } else {\r
86                 *ptr2++ = '\\';\r
87 --\r
88 1.7.0\r