in reply to Re^2: Text::CSV_XS and encoding
in thread Text::CSV_XS and encoding

The detect_bom attribute was added in 1.22. I must admit the the ChangeLog was not very clear about that, as it was part of the new header works and naming all attributes to that didn't look very useful at the time. The docs clearly state:

BOM (or Byte Order Mark) handling is available only inside the "header" method.

The BOM-related changes in versions 1.25, 1.31, 1.33, 1.34, and 1.35 make its use more reliable. Note that BOM-handling is unreliable (or nor working at all) in perl-5.6.x.


Enjoy, Have FUN! H.Merijn

Replies are listed 'Best First'.
Re^4: Text::CSV_XS and encoding
by PeterKaagman (Beadle) on Sep 17, 2018 at 17:23 UTC

    The thing which triggered my interest in BOM detection was an ugly escape sequence at the very beginning of my original data stream. I suspected it to be a BOM. I was kinda hoping BOM detection would get it out of the way. Otherwise I've got to come up with some other way of stripping it off.

      Post the results of this program to show what those bytes at the beginning of the file are.

      #!/usr/bin/perl use strict; use Devel::Peek; open my $FH, "<:raw", "./test2.csv" or die "./test.csv $!"; my $line = <$FH>; Dump $line;
      poj