Commas in A Streamed CSV
Posted on 2006-06-26
I am streaming a CSV file to the browser.
The problems that I'm presented with are the newline char, and the comma char - both for fairly obvious reasons.
I simply stripped the new line, but I don't want to remove the comma completly. One solution I attempted is to place quotes (both single and double) around the strings within the csv. The quotes are simply interpreted as part of the file, and not something denoting the start and end of a string, so this did not work (I am using a stringbuilder to concat my whole csv together before streaming if that is relevant). The other solution was to replace the comma character with an escaped comma ('\,'), but it's not recognized by VS as a valid escape sequence, and therefore craps out on compile.
Any ideas on how to handle this?