Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: Remove BOM ?

by moritz (Cardinal)
on Nov 19, 2008 at 07:39 UTC ( #724497=note: print w/replies, xml ) Need Help??


in reply to Remove BOM ?

You can do it like you want, if you decode the file:
open IN, ':<encoding(UTF-8)', $file or die $!; # your code here

If you don't decode the file, you have to remove the byte sequences that represent the BOM in the encoding that your file has.

Update: The big difference between vim and perl (in this respect) is that vim tries to auto-detect the character encoding (which is a sane thing to do for a text editor, especially if the text are longer, and represent human language) and decodes the text with the guessed encoding, while perl doesn't try to guess anything (which is a sane thing to do for a general purpose programming language).

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://724497]
help
Chatterbox?
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (3)
As of 2016-12-11 00:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    On a regular basis, I'm most likely to spy upon:













    Results (168 votes). Check out past polls.