On Aug 30, 2006, at 12:12 PM, Phil M wrote:

On Aug 30, 2006, at 10:51 AM, Norman Palardy wrote:

What is the proper method of handling CVS export when there is a TEXT/BLOB column with illegal characters like Chr(9), Chr(13) and Chr(10)? Are you suppose to BASE64 encode the data, or are CVS parser suppose to be smart enough to pick all data between the quotes (assume all quotes are escaped)?

Since there's no official "standard" there are lots of things you could do.

Access exports them as is, but few CSV parsers can handle that (mine can because I needed it to) Excel does this as well.

Since those are, for me, two of the most common sources that I get CSV fils from I wrote a parser. It works differently than the built in RB one though because I cannot make it a subclass of any of the Database objects (RecordSet, DatabaesField, etc) Otherwise I'd make it work the exact same

Sorry Norman, but I don't really understand your answer. Are you referring to text data which has been BASE64 encoded, or quote- escaped string data?
Unencoded text.
If you put a chr(13) in a cell in Excel and save that spreadsheet as a CSV you get the CHR(13) inside a quoted string.

And what is the proper way to escape a quote?
Double them up

I am mostly concerned with exporting the data from my database into CVS. I don't really know what software the client would be using to import the data, although I would think that Excel would be pretty common.

I guess I misunderstood and thought you were looking for code to implement a parser to read the data, not write it.

Here's a quick sample from Excel as displayed in HexEdit. This is one cell with quotes and chr(13) in it

         0  22 77 68 61 74 22 22 20 74 68 65 6E 20 3F 71 75  "what"" then ?qu
        16  6F 74 65 3F 0D 53 6F 6D 65 74 68 69 6E 67 20 77  ote?.Something w
        32  69 74 68 20 61 20 63 68 72 28 31 33 30 20 69 6E  ith a chr(130 in
        28  20 69 74 0D 61 6E 64 20 61 6E 6F 74 68 65 72 22   it.and another"

You see quotes doubled up and the chr(13) is actually in the data and no escaping required.

_______________________________________________
Unsubscribe or switch delivery mode:
<http://www.realsoftware.com/support/listmanager/>

Search the archives of this list here:
<http://support.realsoftware.com/listarchives/lists.html>

Reply via email to