Beefy Boxes and Bandwidth Generously Provided by pair Networks
Problems? Is your data what you think it is?
 
PerlMonks  

Re^2: lost in utf8

by oha (Friar)
on Oct 23, 2009 at 20:03 UTC ( [id://802964]=note: print w/replies, xml ) Need Help??


in reply to Re: lost in utf8
in thread lost in utf8

Doesn't the second block of code require a binmode() just for compatibility?

Replies are listed 'Best First'.
Re^3: lost in utf8
by ikegami (Patriarch) on Oct 23, 2009 at 20:24 UTC

    binmode basically disables :crlf and :encoding.

    Since neither were used in the second snippet, we're talking about the default layers from the OS, from $ENV{PERLIO} or from use of the open pragma.

    While using binmode to remove any default :encoding may be smart, it may accidentally disable the :crlf layer. There's no indication that we want the :crlf status to be different, so it's better to use the last snippet if you're dealing with a text file.

    Now, if you're dealing with a binary file, you'd use binmode, and you'd use encode for the text bits. Any LF<->CRLF conversion will have to be handled manually.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-20 12:53 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found