mauricioaniche / repodriller

a tool to support researchers on mining software repositories studies
174 stars 39 forks source link

CSV writer should deal with text with comma #11

Closed mauricioaniche closed 7 years ago

mauricioaniche commented 8 years ago

printing a directory, as an example, might come with a comma (","), and then the CSV gets unformatted.

chripard commented 7 years ago

hi @mauricioaniche , can you be more specific on this?

mauricioaniche commented 7 years ago

Hi @chripard, if you do:

writer.write("field 1", "field 2", "field3, bla bla");

Then, as field3 writes commas, the final CSV will be broken.

What's the best solution for that? Is it for us to print " before field3, e.g., "field3, bla bla"? But then we will have the same issue with ", and we'll have to escape them as well.

See what's this issue about?

chripard commented 7 years ago

hi @mauricioaniche , i understood the first part of the issue that can be fixed by printing the field included in quotes. I can't replicate the issue with ",

mauricioaniche commented 7 years ago

So, suppose the guy does like this:

writer.write("field 1", "field 2", "field3.1, field3.2, \"field3.3\"", "field 4");

The CSV needs to contain 4 columns. The first line should be as follows when I import the CSV:

column 1 = field 1
column 2 = field 2
column 3 = field 3.1, field 3.2, "field 3.3"
column 4 = field 4
chripard commented 7 years ago

okay thanks @mauricioaniche

chripard commented 7 years ago

i think i found a fix for this, shall i pull a request?

mauricioaniche commented 7 years ago

Yes, thanks!

On Mon, Nov 14, 2016, 19:03 Christina Pardalidou notifications@github.com wrote:

i think i found a fix for this, shall i pull a request?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/mauricioaniche/repodriller/issues/11#issuecomment-260411758, or mute the thread https://github.com/notifications/unsubscribe-auth/AAGJzMZLA0pX-7cZ9wejh54Q2VILW3YYks5q-KJhgaJpZM4GyF3B .

Maurício Aniche Postdoc researcher Delft University of Technology www.mauricioaniche.com @mauricioaniche

mauricioaniche commented 7 years ago

57 closes it