| 1 | I've noticed an issue in OGRFeature::GetFieldAsString?() |
| 2 | |
| 3 | when a StringList? value is exported, the following serialized notation is adopted: |
| 4 | |
| 5 | {{{ |
| 6 | - value#1 = "A01" |
| 7 | - value#2 = "B02" |
| 8 | - serialized = "(2:A01,B01)" |
| 9 | }}} |
| 10 | |
| 11 | |
| 12 | 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: |
| 13 | |
| 14 | {{{ |
| 15 | - value#1 = "A,01" |
| 16 | - value#2 = "B,02" |
| 17 | - serialized = "(2:A,01,B,01)" |
| 18 | }}} |
| 19 | |
| 20 | quite obviously, a serialized value like this can never be succesfully parsed so to retrieve the initial values. |
| 21 | |
| 22 | 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: |
| 23 | |
| 24 | {{{ |
| 25 | - value#1 = "A,01" |
| 26 | - value#2 = "B,02" |
| 27 | - serialized = "(2:A,,01,B,,01)" |
| 28 | }}} |
| 29 | |
| 30 | 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. |
| 31 | |
| 32 | please see the attached patch |
| 33 | |
| 34 | best regards, Sandro Furieri |
| 35 | |
| 36 | ---------------------------------------- |
| 37 | |