Changes between Version 2 and Version 6 of Ticket #4397


Ignore:
Timestamp:
Dec 16, 2011, 12:28:18 PM (12 years ago)
Author:
Even Rouault
Comment:

(I've tried to re-establish the first version of the description of the ticket that was lost in a previous edit and might be useful to understand what is discussed here.)

About StringList, yes, you've discovered that there are a bit a second-citizen class of field types. Very few drivers support them appropriately currently. I know PG driver support them in reading/writing because there's a matching type in PG data types. GeoJSON also. But that's almost about all. Other drivers may have read support, like GML. But Shapefile definitely not. DBF format has no adequate representation for such a concept.

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #4397 – Description

    v2 v6  
     1I've noticed an issue in OGRFeature::GetFieldAsString?()
     2
     3when 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
     12this 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
     20quite obviously, a serialized value like this can never be succesfully parsed so to retrieve the initial values.
     21
     22suggested 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
     30a 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
     32please see the attached patch
     33
     34best regards, Sandro Furieri
     35
     36----------------------------------------
     37
    138Hi Even,
    239