Roman Daszczyszak wrote:
> Hello all,

Hello,

> I am using a script to parse a CSV file with approximately 65,000
> records.  Some of these records contain characters such as é, ì, etc.
> I can read and write lines containing these characters via a file
> handle, however when I try and parse the line using the module
> Class::CSV, it fails and returns the error:
> Failed to parse line: <line it failed on>

The characters you describe are not ASCII which is why the module is having
problems with them.

According to the documentation for Class::CSV "Text::CSV_XS is used for
parsing and creating CSV file lines, so any limitations in Text::CSV_XS will
of course be inherant in this module.", and according to the documentation for
Text::CSV_XS:

<quote>
new(\%attr)

[snip]

binary

    If this attribute is TRUE, you may use binary characters in quoted fields,
    including line feeds, carriage returns and NUL bytes. (The latter must be
    escaped as "0.) By default this feature is off.
</quote>

So try setting the binary attribute:

my $csv_file = Class::CSV->new( binary => 1 );

Or if that doesn't work just use the Text::CSV_XS module.



John
-- 
use Perl;
program
fulfillment

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
<http://learn.perl.org/> <http://learn.perl.org/first-response>


Reply via email to