Opened 12 years ago

Last modified 5 years ago

#4397 closed defect

issue in StringList serialization — at Initial Version

Reported by: esseffe Owned by: warmerdam
Priority: normal Milestone: closed_because_of_github_migration
Component: OGR_SF Version: unspecified
Severity: normal Keywords:
Cc: a.furieri@…, Kyle Shannon

Description

I've noticed an issue in OGRFeature::GetFieldAsString()

when a StringList value is exported, the following serialized notation is adopted:

- value#1 = "A01"
- value#2 = "B02"
- serialized = "(2:A01,B01)"

this serialized format is generally fine (and is easily parsable by other apps), but will introduce fatal ambiguities when any COMMA is used by some value to be serialized:

- value#1 = "A,01"
- value#2 = "B,02"
- serialized = "(2:A,01,B,01)"

quite obviously, a serialized value like this can never be succesfully parsed so to retrieve the initial values.

suggested remedy: applying the same criteria used to mask quotes in SQL string, i.e. masking any COMMA found in the string value to be exported as COMMA-COMMA. This would produce the following output:

- value#1 = "A,01"
- value#2 = "B,02"
- serialized = "(2:A,,01,B,,01)"

a serialized string like this has no longer any ambiguity at all; and can be easily and safely parsed so to retrieve the original values.

please see the attached patch

best regards, Sandro Furieri

Change History (1)

by esseffe, 12 years ago

Attachment: comma-patch.zip added
Note: See TracTickets for help on using tickets.