-
Notifications
You must be signed in to change notification settings - Fork 7
Description
Currently, we're writing out JSON- and JSON-alike-Strings without any quotation marks into .csv-files. While this is sufficient for I/O operations in general, it makes manual viewing and manipulating of existing data very unhandy because if the .csv separator is a comma and the json-string contains commas, most (all?) .csv-table-reader cannot display the .csv-file correctly.
I assume that adding quotation marks at the beginning and the end of the strings could solve the problem.
When addressing this, we have to keep the following in mind:
- this might cause the need to adapt I/O operations (especially reading .csv-files)
- this might cause the need to adapt several I/O tests to ensure that the new handling is working
IMHO the following Strings are affected:
- Point
- LineString
- Characteristics
Please add missing Strings that are also affected, if any.
Edit:
After investigating further, it also seems that double quotes are not sufficient for nodeGraphicInput and lineGraphicInput files, but single quotes work. We might consider using single quotes for all files then.
Solution:
According to the csv specification, single quotes (') are not valid, so that double quotes (") must be used.
To escape double quotes ("), as they would otherwise cause problems in the JSON string, double double quotes ("") are specified.
Example:
{"type":"LineString","coordinates":[[7.411111,51.492528],[7.414116,51.484136]],"crs":{"type":"name","properties":{"name":"EPSG:4326"}}}
converts to:
"{""type"":""LineString"",""coordinates"":[[7.411111,51.492528],[7.414116,51.484136]],""crs"":{""type"":""name"",""properties"":{""name"":""EPSG:4326""}}}"
TODOS:
- Adjust FileSink to double quote all csv data objects
- Determine JSON String and double quote double quotes
- Adjust Factory to remove all double quotes