Hi, This is awful, but:
replace(csv:serialize($csv), '([^
])[
]', '$1
') That results in CRLF for me when served from RESTXQ. Hopefully, there is a better answer. csv:serialize complained that it didn’t recognize the option ‘item-separator’ or the option ‘method’. I didn’t try the file function. Maybe it works there. This might have a typo: “tems can also be serialized as JSON if the Serialization Parameter method is set to csv.” in: http://docs.basex.org/wiki/CSV_Module#csv:serialize Kendall On 11/29/17, 2:44 AM, "basex-talk-boun...@mailman.uni-konstanz.de on behalf of George Sofianos" <basex-talk-boun...@mailman.uni-konstanz.de on behalf of gsf.gre...@gmail.com> wrote: Hi, What I'm trying to do is serialize a CSV with CRLF newlines in Linux using BaseX. It's not really important since my CSV parser supports both newlines, but maybe this discussion can help me understand how BaseX serialization works, or create an improvement for BaseX. I'm running BaseX GUI (latest snapshot). I have a sequence of strings that are CSV. I'm using fn:serialize with an item-separator of xml entity 
 I'm then returning this output as a result of the script. This gives me about 200 lines of CSV. Copy pasting these lines into an editor, or using the Save button from the GUI, saves these values with an LF newline character. The RFC [2] for CSV files recommends a CRLF character for CSV, so it would be nice if I can serialize this from BaseX directly. I tried some options from the wiki [1] but had no luck. File module also uses a system specific newline character. [3] Maybe this is something that could be a part of CSV serialization issue [4] , or maybe it is already possible to achieve this somehow. Thanks, George [1|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_Serialization&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=xnyCt8OzH6uYfja9WTPafSfCb6z4Xfq7wsTK_WlxGGc&e=] [2|https://urldefense.proofpoint.com/v2/url?u=https-3A__tools.ietf.org_html_rfc4180-23section-2D2&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=f90XqUlysE4EosoDkbQL6CTEkpg35kUhKkmlK6juXY0&e=] [3|https://urldefense.proofpoint.com/v2/url?u=http-3A__docs.basex.org_wiki_File-5FModule-23file-3Awrite-2Dtext-2Dlines&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=5UXzyZR-HJyffZELtzCZaECemWJnPSkb_wmgFjgDxe0&e=] [4|https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_BaseXdb_basex_issues_1518&d=DwICaQ&c=DS6PUFBBr_KiLo7Sjt3ljp5jaW5k2i9ijVXllEdOozc&r=JgwnBEpN1c-DDmq-Up2QMq9rrGyfWK0KtSpT7dxRglA&m=zyKKuJUW_7CAq5fxGj8zjpgYG-GKpQdveEsgPi8BVKo&s=E-7_NaFPPP_PCUioDBWRaq2jouQno-v4D9LMbeF0gRo&e=]