rust-csv icon indicating copy to clipboard operation
rust-csv copied to clipboard

Is Linear TSV supported?

Open mispecto opened this issue 3 years ago • 1 comments

According to this article: https://en.wikipedia.org/wiki/Tab-separated_values#Conventions_for_lossless_conversion_to_TSV characters \n, \t, \r and \\ should be allowed to be escaped using '' character.

Is my understanding correct, that rust-csv only allows to use \ character in context of double-quotes escaping (using csv::ReaderBuilder.escape(Some('\\')) option), or I'm missing some way to configure Linear TSV parser properly?

Thanks!

mispecto avatar Jan 23 '22 10:01 mispecto

The Wikipedia article is wishy washy here. If your second link is the true definition of "linear" TSV, then the relevant section is this:

Linear TSV provides for escape sequences, instead of quoting, so that implementations can naively split on the byte values of the separators.

Indeed, this crate does not support this. The only character you can escape is the quote character. The way to insert other special characters is to write them as literals inside of quotes.

I would be willing to add support for this option if it's a small one and opt-in.

BurntSushi avatar Jan 23 '22 12:01 BurntSushi