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

document that {read,write}dlm follow RFC 4180 #5

Open
zarakay opened this issue Dec 13, 2016 · 8 comments
Open

document that {read,write}dlm follow RFC 4180 #5

zarakay opened this issue Dec 13, 2016 · 8 comments
Labels
doc help wanted Extra attention is needed I/O

Comments

@zarakay
Copy link

zarakay commented Dec 13, 2016

So from my understanding, the writedlm function is used to write arrays to file. When writing an array with strings that have an escaped double quotation mark, unexpected output occurs. This can be reproduced in the REPL

Command To Reproduce

writedlm(STDOUT, ["\"Hello World\""])

Output

"""Hello World"""

Expected Output

""Hello World""

I could not find anything in the documentation that would explain why this would happen, and it seems fine for single quotation marks and any other escaped character

Version Info

Julia Version 0.5.0
Commit 3c9d753 (2016-09-19 18:14 UTC)
Platform Info:
  System: Darwin (x86_64-apple-darwin13.4.0)
  CPU: Intel(R) Core(TM) i7-4870HQ CPU @ 2.50GHz
  WORD_SIZE: 64
  BLAS: libopenblas (USE64BITINT DYNAMIC_ARCH NO_AFFINITY Haswell)
  LAPACK: libopenblas64_
  LIBM: libopenlibm
  LLVM: libLLVM-3.7.1 (ORCJIT, haswell)
@kshyatt kshyatt added the I/O label Dec 13, 2016
@StefanKarpinski
Copy link
Member

StefanKarpinski commented Dec 13, 2016

DLM isn't a real format, and CSV isn't a single standard, but... this seems to follow the common rules for CSV, which mean that " characters inside of double-quoted fields are represented by "", which is what's happening here. And, of course, dlmwrite delenda est.

@zarakay
Copy link
Author

zarakay commented Dec 13, 2016

Hiya, thanks for the reply

Firstly having your write out DLM in all caps suddenly makes more sense, I had been thinking for a while that the function had a weird name...

Secondly I had no idea what the CSV "standard" did that to double quotation marks, I had just assumed it escaped it.

Seeing that this is not a bug, just a misunderstanding of how double quotation marks are represented in CSV, I am going to go ahead and close the issue.

Thanks for your help

@zarakay zarakay closed this as completed Dec 13, 2016
@StefanKarpinski
Copy link
Member

No worries – CSV is a confusing and generally terrible format, but it's better all the other ones we have for text-based tabular data.

@nalimilan
Copy link
Member

nalimilan commented Dec 14, 2016

It could be useful to mention in the docstring that we take RFC 4180 as the reference for the format.

@StefanKarpinski StefanKarpinski added doc help wanted Extra attention is needed labels Dec 14, 2016
@StefanKarpinski StefanKarpinski changed the title Unexpected Behavior in "writedlm" document that {read,write}dlm follow RFC 4180 Dec 14, 2016
@StefanKarpinski
Copy link
Member

Updated as a doc issues. (readdlm delenda est.)

@martinholters
Copy link

And as a doc issue, it should be reopened, I guess...

@martinholters martinholters reopened this Dec 14, 2016
@ViralBShah
Copy link
Contributor

ViralBShah commented Mar 13, 2022

Given that CSV.jl is now a separate package, do we still need to mention RFC 4180 in readdlm?

@nalimilan
Copy link
Member

As long as the function exists I guess it's worth documenting what it does.

@ViralBShah ViralBShah changed the title document that {read,write}dlm follow RFC 4180 document that readdlm and writedlm follow RFC 4180 Apr 8, 2022
@ViralBShah
Copy link
Contributor

For some reason, I can't transfer this issue to DelimitedFiles.jl

@DilumAluthge
Copy link

@DilumAluthge
Copy link

@ViralBShah Something has gone horribly wrong. There are now like 5+ copies of this issue on DelimitedFiles.jl.

@ViralBShah
Copy link
Contributor

ViralBShah commented Apr 8, 2022

Yeah I kept thinking I did it and it wouldn't happen. And it still exists here.

@ViralBShah
Copy link
Contributor

Deleted the others. Let's see. It still says transfer in progress.

@ViralBShah ViralBShah transferred this issue from JuliaLang/julia Apr 8, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
doc help wanted Extra attention is needed I/O
Projects
None yet
Development

No branches or pull requests

7 participants