Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine

Re^2: lost in utf8

by oha (Friar)
on Oct 23, 2009 at 20:03 UTC ( #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?

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (8)
As of 2022-01-24 14:22 GMT
Find Nodes?
    Voting Booth?
    In 2022, my preferred method to securely store passwords is:

    Results (64 votes). Check out past polls.