Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw
 
PerlMonks  

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.

Comment on TEXT::CSV Error 2032
Select or Download Code
Re: TEXT::CSV Error 2032
by Tux (Monsignor) 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 (Monsignor) 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?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://978208]
Approved by Corion
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (2)
As of 2014-09-17 02:44 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (56 votes), past polls