Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^3: Text::CSV_XS and encoding

by Tux (Canon)
on Sep 17, 2018 at 06:31 UTC ( [id://1222500]=note: print w/replies, xml ) Need Help??


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 (Sexton) 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

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (5)
As of 2024-04-18 02:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found