About

In order to create a CSV string from a list, the following operations must be performed on each element of the list:

  • if the list element contains a comma (',') then the element must be placed between double quotes (").
  • if the list element contains double-quotes (") then the double quotes must be escaped by pre-pending another double quote.

And spaces are considered to be part of the data, however, many implementations treat the following cases differently:

hi, there

is sometimes encoded to a list containing the elements:

hi
there

in broken implementations, such as LSL's llList2CSV and llCSV2List while some implementations (those closer to RFC 4180) encode the string to a list containing the elements:

hi
 there

with the space preceding there.

In order to pacify the situation, we add an extra requirement for our encoders that list elements that contain spaces must be escaped with double-quotes. This does not break anything because RFC 4180 states that "5. Each field may or may not be enclosed in double quotes […]" which makes an quote-enclosed string such as "Hello" equivalent to Hello with or without the quotes.

Index


fuss/data_structures/comma_separated_values/list.txt · Last modified: 2019/01/03 01:39 (external edit)

Access website using Tor Access website using i2p


For the copyright, license, warranty and privacy terms for the usage of this website please see the license, privacy and plagiarism pages.