Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
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).


Comment on Re: Remove BOM ?
Download Code

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 having an uproarious good time at the Monastery: (15)
As of 2015-07-07 22:00 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (93 votes), past polls