john-liu / jaql

Automatically exported from code.google.com/p/jaql
0 stars 0 forks source link

Improve escaping support for the conversion from/to CSV #84

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
For the conversion from JSON to CSV, if escape option is true, the

following escapings happen:

1. " is escaped into "".

2. Some characters are escaped into 2-character escape sequences such as \t (2

characters).

3. Some ISO control characters are escaped into 6-character escape
sequences such

as \u008a.

For the conversion from CSV to JSON, escape option is in effect only if

quoted option is true. 

1. "" is unescaped into ". 

2. 2-character escape sequences such as \t (2 characters)

are unescaped into the character represented by the escape sequence.

3. 6-character escape sequences such as \u008a are unescaped into the

unicode character represented by the escape sequence.

For a input CSV file containing "\\" (4 characters):

1. \ (1 backslash character) is the unescaped result if both quoted option and

escape option are true. 

2. \\ (2 backslash characters) is the unescaped result if quoted option is

true and escape option is false. 

3. "\\" (1 quotation mark, 2 backslash characters and 1 quotation mark) is
the unescaped result if quoted option is false.

Original issue reported on code.google.com by yaojingguo@gmail.com on 2 May 2010 at 1:41

GoogleCodeExporter commented 9 years ago
Since there is no way to correct the previous comment. I decide to close it and 
open
another issue for this enhancement.

Original comment by yaojingguo@gmail.com on 2 May 2010 at 1:43