Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>CSV represents strings which are separated by characters. In your case, a line could look like this</p> <pre><code>foo,bar,baz </code></pre> <p>This represents three fields with the values of <code>foo</code>, <code>bar</code>, and <code>baz</code>. Now the question is, what happens if one of the fields contains a comma? If you don't mark is specially, it would be considered a field separator. This mark is done using escape-characters. In your case a single backslash. So we could have something like</p> <pre><code>foo\, blarb,bar,baz </code></pre> <p>which would be read as <code>foo\, blarb</code>, <code>bar</code>, and <code>baz</code>. Now you could optionally surround your fields with quotation marks, but you would still need to escape quotation marks which would be part of your field values. In the end, it is always a question how to create a representation of your data which is <em>unambigious</em>.</p> <p>For your line termination question: <code>\r</code> is a common representation the ASCII character for Carriage return (the Byte 13). <code>\n</code> is a newline character (ASCII 10). These two characters are used to represent the end of a line on Windows and certain protocols like HTTP. On Unix/Linux, only <code>\n</code> is typically used. Incidentally, the <code>\n</code> and <code>\r</code> notation also employs escapes.</p> <p>As a general note, if you see backslashes just before certain characters in serialized text, it is often some kind of escape mechanism. The backslash is a very popular character for this as it is rather rare in normal text.</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload