The manual page for
Text::CSV does state:
This module is based upon a working definition of CSV format which may not be the most general.
Allowable characters within a CSV field include 0x09 (tab) and the inclusive range of 0x20 (space) through 0x7E (tilde).
Now let's look at how this part of the spec is implemented:
# ~LINE 308
} elsif ($$line_ref =~ /^[\t\040-\176]/) {
# a tab, space, or printable...
+
$$piece_ref .= substr($$line_ref, 0 ,1);
substr($$line_ref, 0, 1) = '';
The first thing I notice is that he says 0x20 (space) through 0x7E (tilde). but the code has /^[\t\040-\176]/.
- I believe this is because hex 20 equals 40 in some other number system. But is the number system octal or decimal and how would I know?
- How can I make this regular expression accept unicode characters? I have some CSV files with Unicode characters which Text::CSV barfs on..
- thank God there is a Text::CSV so I could track this down... There is a faster module with the same API Text::CSV_XS that I would have had no hope of finding the problem. Then I would've had to properly parse CSV files on my own. eek.
Carter's compass: I know I'm on the right track when by deleting something, I'm adding functionality
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.