I am using Text::CSV to parse a csv file. Not all lines can be parsed, because of some bad characters.
The Text::CSV documentation says:
Allowable characters within a CSV field include 0x09 (tab) and the inclusive range of 0x20 (space) through 0x7E (tilde).
How can I filter out as easy as possible any not-allowed characters?
Instead of filtering out the “bad” characters, you probably want to use the
binaryflag to tell Text::CSV to stop enforcing its ASCII-only rule:If you’re trying to read a file that’s in a non-ASCII character set (e.g. Latin-1 or UTF-8), you should look at the Text::CSV::Encoded module.