Hi Markus -
On Wed, Apr 6, 2022 at 9:25 AM Markus Elfring Markus.Elfring@web.de wrote:
No quotes will be added, as your delimiter does not occur in the text
value.
How does this feedback fit to previously provided information?
A) https://docs.basex.org/wiki/CSV_Module#Options “… Serialization: If the option is enabled, the value will be wrapped with quotes if it contains characters that might be treated as control characters. …”
B) https://mailman.uni-konstanz.de/pipermail/basex-talk/2022-April/017038.html “… The double quote is the text qualifier that’s used for serializing fields with spaces. …”
Another XQuery script example: declare option output:method "csv"; declare option output:csv "header=yes, quotes=yes, separator=|";
<csv> <record> <T3>line 1 line 2?</T3> <T4>line 3\nline 4?</T4> </record> </csv>
Test result: T3|T4 "line 1 line 2?"|line 3\nline 4?
Will any more clarification help here?
I confess that I'm not sure, but if you're asking "Why are there double
quotes around my `T3` field?", then the answer appears to be in the CSV specification[1]. So, the behavior you're seeing in your sample script matches the CSV RFC.
If that wasn't your question, it might help to restate, or reframe, your questions and concerns.
Regards, Markus
Best wishes, Bridger
[1] https://datatracker.ietf.org/doc/html/rfc4180#section-2, specifically part 6:
Fields containing line breaks (CRLF), double quotes, and commas
should be enclosed in double-quotes. For example: "aaa","b CRLF bb","ccc" CRLF zzz,yyy,xxx