Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Change the delimiter #6

Closed
PPCM opened this issue Apr 27, 2018 · 9 comments
Closed

Change the delimiter #6

PPCM opened this issue Apr 27, 2018 · 9 comments

Comments

@PPCM
Copy link

PPCM commented Apr 27, 2018

Is it possible to change the delimiter to ; for example ?
Excel doesn't parse a CSV with comma as delimiter

@ryu1kn
Copy link
Owner

ryu1kn commented May 2, 2018

Hello @PPCM , what do you mean by excel doesn't parse a CSV?

I created a CSV file (comma separated values) saved with the name test.csv, then opened it with Excel. It all looked fine, as in, different fields appeared in the different columns as expected.

@ryu1kn
Copy link
Owner

ryu1kn commented May 10, 2018

Hi @PPCM , I'm closing this for now as I'm not getting the more information. Feel free to reopen it if you have more things to add 😉

@PPCM
Copy link
Author

PPCM commented May 25, 2018

Sorry for the long time
In my case, Excel 2016 open the file with each line in a simple cell, even if I use the import feature

@Sigfried
Copy link

Sigfried commented Aug 9, 2018

I have the same question: can I use tab delimiters? In my case I'm writing data that is coming from a tsv and has commas and quotes in the data.

@ryu1kn
Copy link
Owner

ryu1kn commented Aug 11, 2018

Hi @Sigfried . At the moment, no, csv-writer produces only CSV.

Do you actually want to produce TSV, or are you ok with CSV as long as commas/quotes in the data are properly handled? csv-writer should be able to produce a properly formatted CSV file by automatically escaping comma/quote characters (like this).

@ryu1kn
Copy link
Owner

ryu1kn commented Aug 19, 2018

I didn't know Excel assumes semicolon as a field delimiter in some regions. Given that Excel is widely used software to consumer CSV, I'm going to support this variance even though it's not RFC4180 compliant. Thanks @PPCM & @Sigfried for flagging the issue!

From #8 (comment)

Ok, I found that, on Windows, depending on the "Regional and Language Options" settings, Excel assumes different characters for the field delimiter...

Seems we do need to support ; as a delimiter. Now I need to find what is the escaping rule for the field value when ; is used as a separator.

Also from Wikipedia

Adjacent fields must be separated by a single comma. However, "CSV" formats vary greatly in this choice of separator character. In particular, in locales where the comma is used as a decimal separator, semicolon, TAB, or other characters are used instead.

@ryu1kn ryu1kn reopened this Aug 19, 2018
@ryu1kn
Copy link
Owner

ryu1kn commented Aug 19, 2018

Changed List separator from , to ; and Excel used ; for field separator when I saved data into a CSV file. Fields containing , are not wrapped with double-quotes, but fields containing ; are now wrapped instead.

list-separator-settings

@ryu1kn
Copy link
Owner

ryu1kn commented Aug 20, 2018

Merged PR #8 , thanks @HKskn !!

@ryu1kn
Copy link
Owner

ryu1kn commented Aug 20, 2018

Published as v1.1.0. Now semicolon is also treated as a valid field separator. I'll create a separate card for TSV.

@ryu1kn ryu1kn closed this as completed Aug 20, 2018
@ryu1kn ryu1kn mentioned this issue Aug 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants