Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re^2: Parsing a text file without newlines

by existem (Sexton)
on Dec 14, 2004 at 12:04 UTC ( #414689=note: print w/replies, xml ) Need Help??


in reply to Re: Parsing a text file without newlines
in thread Parsing a text file without newlines

well i'm running the script on a linux machine, but i'm guessing the csv file was probably created on windows and has some funny windows encoding or something like that...?

I tried using Text::CSV_XS

my $csv = Text::CSV_XS->new({ 'quote_char' => '"', 'escape_char' => '"', 'sep_char' => ',', 'binary' => 1 });

I changed binary to 1 and that solved a similar problem I had with another csv file, but hasn't made a difference to this file.

Is there a setting somewhere for different types of files, like those created on windows or those from unix?

Replies are listed 'Best First'.
Re^3: Parsing a text file without newlines
by jZed (Prior) on Dec 14, 2004 at 16:42 UTC
    It sounds like you need to set the eol flag. Look at the file in a hex editor to find out what the line endings really are (your editor may hide some things) or else just experiment with eol set to \012 or \015\012 or \015.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://414689]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2022-08-14 07:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?