Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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 the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others pondering the Monastery: (7)
As of 2016-09-28 08:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Extraterrestrials haven't visited the Earth yet because:







    Results (523 votes). Check out past polls.