Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

TEXT::CSV Error 2032

by endymion (Acolyte)
on Jun 25, 2012 at 14:22 UTC ( #978208=perlquestion: print w/replies, xml ) Need Help??
endymion has asked for the wisdom of the Perl Monks concerning the following question:

Hello Monks, I have a problem with the text::csv_xs module. I get an error CSV_XS ERROR: 2023 EIF - CR char inside unquoted., not part of EOL @ Pos 1 to 92 (all my rows I want to parse). My arguments are:
quote char => '"', sep_char=>"$sep(; or : and so on), allow_loose_escapes=>1, empty_is_undef=>1, binary=>1, auto_diag=>1
It is fine working with my test csv file. For example:
LA390CD005:QK MXER 150 grün:171:85: and my real Data is for example one line 051999910946:IWESA GMBH::STREET NO 6A:DE:66000:SARbRÜCKEN
Any ideas why I get this error. Maybe about the German chars ? But in the Testfile I also have every special char.

Replies are listed 'Best First'.
Re: TEXT::CSV Error 2032
by Tux (Abbot) on Jun 25, 2012 at 14:35 UTC

    How did you open the file? e.g. Do you know the exact encoding of the data, as you should then use that knowledge to open the file

    my $csv = Text::CSV_XS->new ({ binary => 1, auto_diag => 1 }); open my $fh, "<:encoding(utf-8)", $filename or die "..."; while (my $row = $csv->getline ($fh)) { ...

    Is the data "private" or can I get a copy of the file?

    Enjoy, Have FUN! H.Merijn
Re: TEXT::CSV Error 2032
by Happy-the-monk (Canon) on Jun 25, 2012 at 16:13 UTC

    CSV_XS ERROR: 2023 EIF - CR char inside unquoted

    Not knowing the Text::CSV module at all, I read the error message like this:

    "There is a CR - carriage return inside of your CSV data, but it is not at the end-of-line."

    I understand: the operating system where you are getting this message is not using carriage return+line feed as the end-of-line marker, but maybe just the line feed.

    This may seem strange, but maybe it is all there is to it.

    Have you tried dos2unix or something similar on your data or would that break it?

    If it doesn't succeed, the CR might be somewhere inside the data, not anywhere close to the end-of-line."

    Cheers, Sören

      Completely wrong. All of it. Text::CSV_XS automatically deals with CR and/or NL in CSV streams/files.

      When in doubt, read the manpage:

      2023 "EIQ - QUO character not allowed" Sequences like "foo "bar" baz",quux and 2023,",2008-04-05,"Foo, Bar",\ +n will cause this error.

      update: Sorry for that tone. I got sidetracked by the wrong paste in the OT. He used a message-code mismatch. I look at codes

      2032 "EIF - CR char inside unquoted, not part of EOL"

      2032 != 2023. Most of the time, NOT passing eol to the constructor is likely to solve the issue

      Enjoy, Have FUN! H.Merijn

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://978208]
Approved by Corion
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (2)
As of 2018-04-23 22:04 GMT
Find Nodes?
    Voting Booth?