Julia: document that {read,write}dlm follow RFC 4180

Created on 13 Dec 2016  路  6Comments  路  Source: JuliaLang/julia

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)
O doc help wanted

Most helpful comment

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

All 6 comments

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.

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

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

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

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

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

Was this page helpful?
0 / 5 - 0 ratings