In order to create a CSV string from a list, the following operations must be performed on each element of the list:
"
)."
) 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.