Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
C0D4669025y"Foo", "bar", "c", "1", 34, 56.63
foo, bar, "c, that was a delimiter back there" , 1, "56.633"
Got to love mixed content 😞
Sometimes I really wonder if a system generated it or someone was crazy enough to write it them selves and save it. -
Honestly, this sounds entertaining. It can easily be parsed with a recursive function.
-
-
devasood25yI have worked with a CSV, which has a free text column, which had such bad characters that they broke utf-8, ASCII and other encodings, had newline characters and all sorts of delimiters like tab, comma, semicolons, combinations of delimiters, non-breaking whitespace etc. It was not a double quoted column. So you could not read line and expect the entire row. You could not split by comma and get the columns. Splitting by comma could give you the number of columns you need, less than that or more than that depending on row. The free text field column data interchangibly had html, code in all different programming languages, comments. It was a stream of GitHub data
Alright since I have to deal with this shit in my part time job I really have to ask.
What is the WORST form of abusing CSV you have ever witnessed?
I for one have to deal with something like this:
foo,1,2,3,4,5
0,2,4,3,2,1
0,5,6,4,3,1
bar,,,,,
foobar,,,,,
foo can either be foo, or a numeric value
if it is foo, the first number after the foo dictates how many times the content between this foo and the next bar is going to be repeated. Mind you, this can be nested:
foo,1,,,,
1,2,3,4,5,6
foo,10,,,,
6,5,4,3,2,1,
bar,,,,,
1,2,3,4,5,6
bar,,,,,
foobar,,,,,
foobar means the file ends.
Now since this isn't quite enough, there's also SIX DIFFERENT FLAVOURS OF THIS FILE. Each of them having different columns.
I really need to know - is it me, or is this format simply utterly stupid? I was always taught (and fuck, we always did it this way) that CSV was simply a means to store flat and simple data. Meanwhile when I explain my struggle I get a shrug and "Just parse it, its just csv!!"
To top it off, I can not use the flavours of these files interchangably. Each and everyone of them contains different data so I essentially have to parse the same crap in different ways.
OK this really needed to get outta the system
question
csv stupid angry