Re: freebcp adding escaping

"Craig A. Berry" <[email protected]>
Newsgroups gmane.comp.db.tds.freetds
Message-ID <[email protected]>
> On Apr 23, 2016, at 1:04 PM, James K. Lowden <[email protected]> wrote:
> 
> On Fri, 22 Apr 2016 16:29:42 +0200
> Fredy Paquet <[email protected]> wrote:
> 
>> Your CSV parser is very interesting, but it doesn't seem to handle
>> the ugly quoting rules for CSV correctly. Also newline within a text
>> field isn't processed correctly.
> ...
>> Isn't there any better implementation around ?
> 
> As mentioned in the man page, you might look at
> http://sourceforge.net/projects/libcsv/.  
> 
> I don't remember why I wrote my own implementation, other than wanting
> to try my hand at writing a parser.  Again, if there is interest in
> incorporating the feature in FreeTDS, I would be willing to polish it
> up.  The challenge, btw, isn't so much to parse standard CSV files
> correctly.  The challenge is that, in practice, many CSV files don't
> conform to the standard, yet the library is expected to DTRT
> regardless.  
> 

There is a Perl extension that I think handles a lot of the corner cases:

https://github.com/Tux/Text-CSV_XS

The file CSV_XS.xs would be where the underlying C implementation resides.  It would take some work to disentangle from the Perl interpreter details, but the logic is there.

________________________________________
Craig A. Berry
mailto:[email protected]

"... getting out of a sonnet is much more
 difficult than getting in."
                 Brad Leithauser
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.