Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
CSV and double quotes
Message
De
20/04/2015 15:36:44
Dragan Nedeljkovich (En ligne)
Now officially retired
Zrenjanin, Serbia
 
 
À
19/04/2015 16:52:23
Information générale
Forum:
Visual FoxPro
Catégorie:
Codage, syntaxe et commandes
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows 7
Network:
Windows 2008 Server
Database:
Visual FoxPro
Application:
Desktop
Divers
Thread ID:
01618070
Message ID:
01618820
Vues:
41
>>The very idea that a text file can be trusted to carry data, delimited by characters that may be expected to exist inside the data, is the initial bug.
>
>What a nonsense! The COPY TO CSV should have added the second double quote. THERE is the bug.

Second? There are four already :). Or you mean it should have doubled, the contained quotation marks, perhaps? To create something BASIC-styled like
txt
"is weer ""ziek"""
That would have been a beginning of that contract, provided that the append command would know to convert double quotation marks into single, and treat the odd quotation marks as delimiters... unless in position 1 where the initial one is taken as the delimiter and then it should expect text after that. I.e. in
"""this"" is not ""that"""
There from the first triplet the first q.m. is the delimiter, and the other two are to be interpreted; from the last triplet the first two are to be interpreted and the last one is a delimiter. Which, for instance, LibreOffice's Calc does just fine. But it was written ages after Fox.

>> Everything else is a blind implementation of that idea. Anything trying to implement that without a firm contract between the sender and recipient will be buggy.
>>
>>In this case, the bug is in the "copy to effe type csv" command - it produces this:
>>i.e. it blindly wraps quotation marks around a string containing quotation marks. It doesn't even have a contract with itself. That, yes, that is a bug.
>
>Again, what a nonsense! The APPEND FROM CSV should have converted the double double quotes to a single double quote. THERE is the accompanying bug.

I tried to append the above example ("""this"" is not ""that""") and it appends zero records. Which is an even larger bug.

But still, there's no firm rule as to how to incorporate quotation marks inside a string which contains quotation marks. In many systems they need to be doubled, in many they need to be escaped (and then there are several methods on how to escape them). The true bug, to me, is not that it doesn't properly import from an ill-defined standard, but that it doesn't properly import its own export.

back to same old

the first online autobiography, unfinished by design
What, me reckless? I'm full of recks!
Balkans, eh? Count them.
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform