[sqlite] Form-Feed (0x0C) is not a space character in JSON

2015-10-16 Thread Graham Holden
I've not seen the RFC but you say "JSON only has 5 whitespace characters" and 
then list only 4, and your patched array only has four 1's. ?Have you missed 
one, or is the 5 wrong (or am I missing something)?

Graham

Sent from Samsung Mobile

 Original message 
From: Jan Nijtmans <jan.nijtm...@gmail.com> 
Date: 16/10/2015  14:33  (GMT+00:00) 
To: General Discussion of SQLite Database  
Subject: [sqlite] Form-Feed (0x0C) is not a space character in JSON 

Hi all,

Just noted in the jsonIsSpace[] array: According to RFC 7159, JSON
only has 5 whitespace characters, FF (0x0C) is not among them:

? ws = *(
??? %x20 /? ; Space
??? %x09 /? ; Horizontal tab
??? %x0A /? ; Line feed or New line
??? %x0D??? ; Carriage return
??? )

Suggested patch below.

Regards,
 Jan Nijtmans
$ fossil diff
Index: ext/misc/json1.c
==
--- ext/misc/json1.c
+++ ext/misc/json1.c
@@ -50,11 +50,11 @@
** Growing our own isspace() routine this way is twice as fast as
** the library isspace() function, resulting in a 7% overall performance
** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
*/
static const char jsonIsSpace[] = {
-? 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0,
+? 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
?? 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
?? 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
?? 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
?? 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
?? 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
___
sqlite-users mailing list
sqlite-users at mailinglists.sqlite.org
http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users


[sqlite] Form-Feed (0x0C) is not a space character in JSON

2015-10-16 Thread Jan Nijtmans
 Hi all,

Just noted in the jsonIsSpace[] array: According to RFC 7159, JSON
only has 5 whitespace characters, FF (0x0C) is not among them:

  ws = *(
%x20 /  ; Space
%x09 /  ; Horizontal tab
%x0A /  ; Line feed or New line
%x0D; Carriage return
)

Suggested patch below.

Regards,
 Jan Nijtmans
$ fossil diff
Index: ext/misc/json1.c
==
--- ext/misc/json1.c
+++ ext/misc/json1.c
@@ -50,11 +50,11 @@
 ** Growing our own isspace() routine this way is twice as fast as
 ** the library isspace() function, resulting in a 7% overall performance
 ** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
 */
 static const char jsonIsSpace[] = {
-  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0,
+  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,


[sqlite] Form-Feed (0x0C) is not a space character in JSON

2015-10-16 Thread Richard Hipp
On 10/16/15, Scott Doctor  wrote:
>
> Form feeds are ... Often inserted for pagination and
> ignored by compilers or treated the same as a space character.
>

Yeah.  Which is why I originally included them in the whitespace
definition for json1.  But RFC7159 has other ideas.  We'll conform to
RFC7159.
-- 
D. Richard Hipp
drh at sqlite.org


[sqlite] Form-Feed (0x0C) is not a space character in JSON

2015-10-16 Thread Scott Doctor

http://www.ecma-international.org/publications/files/ECMA-ST/ECMA-404.pdf


http://json.org/


Form feeds are allowed in strings. Form feeds are traditionally 
treated the same as a space. Often inserted for pagination and 
ignored by compilers or treated the same as a space character.


Scott Doctor
scott at scottdoctor.com
--

On 10/16/2015 7:46 AM, Graham Holden wrote:
> I've not seen the RFC but you say "JSON only has 5 whitespace characters" and 
> then list only 4, and your patched array only has four 1's.  Have you missed 
> one, or is the 5 wrong (or am I missing something)?
>
> Graham
>
> Sent from Samsung Mobile
>
>  Original message 
> From: Jan Nijtmans 
> Date: 16/10/2015  14:33  (GMT+00:00)
> To: General Discussion of SQLite Database  mailinglists.sqlite.org>
> Subject: [sqlite] Form-Feed (0x0C) is not a space character in JSON
>   
> Hi all,
>
> Just noted in the jsonIsSpace[] array: According to RFC 7159, JSON
> only has 5 whitespace characters, FF (0x0C) is not among them:
>
>ws = *(
>  %x20 /  ; Space
>  %x09 /  ; Horizontal tab
>  %x0A /  ; Line feed or New line
>  %x0D; Carriage return
>  )
>
> Suggested patch below.
>
> Regards,
>   Jan Nijtmans
> $ fossil diff
> Index: ext/misc/json1.c
> ==
> --- ext/misc/json1.c
> +++ ext/misc/json1.c
> @@ -50,11 +50,11 @@
> ** Growing our own isspace() routine this way is twice as fast as
> ** the library isspace() function, resulting in a 7% overall performance
> ** increase for the parser. (Ubuntu14.10 gcc 4.8.4 x64 with -Os).
> */
> static const char jsonIsSpace[] = {
> -  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 1, 1, 0, 0,
> +  0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users
> ___
> sqlite-users mailing list
> sqlite-users at mailinglists.sqlite.org
> http://mailinglists.sqlite.org/cgi-bin/mailman/listinfo/sqlite-users