[notmuch] [PATCH] json_quote_str should handle non-ASCII characters

2010-04-13 Thread Carl Worth
On Thu, 04 Mar 2010 11:40:03 +0100, Gregor Hoffleit  
wrote:
> The current code in json_quote_str() only accepts strict printable ASCII
> code points (i.e. 32-127), all other code points are dropped from the
> JSON output.
> 
> This patch accepts code points 32-255.

Thanks, Gregor!

I've pushed this patch out now.

And I noted in our TODO file that we really should add some tests to the
test suite to exercise our --format=json code paths. It would be nice to
ensure we don't have any regressions in this area later.

-Carl
-- next part --
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: 



[notmuch] [PATCH] json_quote_str should handle non-ASCII characters

2010-03-04 Thread Gregor Hoffleit
* Sebastian Spaeth  [Do M?r 04 14:57:27 +0100 2010]
> On 2010-03-04, Sebastian Spaeth wrote:
> > The current code in json_quote_str() only accepts strict printable ASCII
> > code points (i.e. 32-127), all other code points are dropped from the
> > JSON output.
> 
> That would explain why my web interface does not display any umlaut
> symbols.

Well, I noticed noneatall umlauts. That's how I found this problem.

Regards,
Gregor


[notmuch] [PATCH] json_quote_str should handle non-ASCII characters

2010-03-04 Thread Sebastian Spaeth
On 2010-03-04, Sebastian Spaeth wrote:
> The current code in json_quote_str() only accepts strict printable ASCII
> code points (i.e. 32-127), all other code points are dropped from the
> JSON output.

That would explain why my web interface does not display any umlaut
symbols.

Nice finding,
Sebastian


[notmuch] [PATCH] json_quote_str should handle non-ASCII characters

2010-03-04 Thread Gregor Hoffleit
The current code in json_quote_str() only accepts strict printable ASCII
code points (i.e. 32-127), all other code points are dropped from the
JSON output.

This patch accepts code points 32-255.

json_quote_str() should handle non-ASCII characters.
---
 json.c |4 ++--
  1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/json.c b/json.c
index 9614143..6dc0345 100644
--- a/json.c
+++ b/json.c
@@ -59,7 +59,7 @@ json_quote_str(const void *ctx, const char *str)
return NULL;

 for (ptr = str; *ptr; len++, ptr++) {
-   if (*ptr < 32 || *ptr == '\"' || *ptr == '\\')
+   if ((unsigned char)(*ptr) < 32 || *ptr == '\"' || *ptr == '\\')
len++;
 }

@@ -70,7 +70,7 @@ json_quote_str(const void *ctx, const char *str)

 *ptr2++ = '\"';
 while (*ptr) {
-   if (*ptr > 31 && *ptr != '\"' && *ptr != '\\') {
+   if ((unsigned char)(*ptr) > 31 && *ptr != '\"' && *ptr != '\\') {
*ptr2++ = *ptr++;
} else {
*ptr2++ = '\\';
--
1.7.0


Re: [notmuch] [PATCH] json_quote_str should handle non-ASCII characters

2010-03-04 Thread Gregor Hoffleit
* Sebastian Spaeth sebast...@sspaeth.de [Do Mär 04 14:57:27 +0100 2010]
 On 2010-03-04, Sebastian Spaeth wrote:
  The current code in json_quote_str() only accepts strict printable ASCII
  code points (i.e. 32-127), all other code points are dropped from the
  JSON output.
 
 That would explain why my web interface does not display any umlaut
 symbols.

Well, I noticed noneatall umlauts. That's how I found this problem.

Regards,
Gregor
___
notmuch mailing list
notmuch@notmuchmail.org
http://notmuchmail.org/mailman/listinfo/notmuch