While reading a UTF-16 encoded file (with "FIL" as the file handle), I get the error in the middle of reading the file:
UTF-16:Unrecognised BOM 2550 at H:\script\exceptions.pl line 64, <FIL>
+ line 127
7.
I did run a google search for "BOM 2550", and anticipate the FBI will be here soon. ;) I hope they know Perl.
I'm using simply
open FIL, $_ or die "could not open $_: $!\n";
binmode FIL, ":encoding(UTF-16)";
to open the file.
I do see the following in the documentation for binmode, but I don't quite grasp whether it bears directly on the issue I have.
Another consequence of using binmode() (on some systems) is that speci
+al end-of-file markers will be seen as part of the data stream. For s
+ystems from the Microsoft family this means that if your binary data
+contains \cZ, the I/O subsystem will regard it as the end of the file
+, unless you use binmode().
binmode() is not only important for readline() and print() operations,
+ but also when using read(), seek(), sysread(), syswrite() and tell()
+ (see the perlport manpage for more details). See the $/ and $\ varia
+bles in the perlvar manpage for how to manually set your input and ou
+tput line-termination sequences.
Anyone know what it means, or how I can fix it?
update: On Windows XP
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.