kweise has asked for the wisdom of the Perl Monks concerning the following question:

Hi,
I am using TEXT::CSV to create a CSV file, using the combine and string commands. I have a field that contains double quotes. I want to escape these double quotes with a backslash (unix style). However, even by setting {escape_char => “\\”} within the new method, the output contains “” to escape the quote.

Example, original date: MV"APL BOGOTA"(EX CMA CGM MANZ
Method: $csv = Text::CSV->new ({ escape_char => "\\" })
Result: "MV""APL BOGOTA""(EX CMA CGM MANZ"

I am expecting to get "MV\"APL BOGOTA\"(EX CMA CGM MANZ"

Any ideas? I've even tried doing my own substitution and adding the backslash to quote beforehand, but I still end up the 2 double quotes. Thanks!!

Replies are listed 'Best First'.
Re: Text::CSV doubling double quotes on combine?
by ikegami (Patriarch) on Jun 19, 2008 at 22:02 UTC

    What version are you using?

    perl -le"use Text::CSV; print Text::CSV->VERSION"

    It needs to be ≥1.00

      It comes back as "0.01", sounds low. So I will see if there's an update, thanks!