Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^2: Simplest Possible Way To Disable Unicode

by ikegami (Pope)
on May 24, 2011 at 01:21 UTC ( #906400=note: print w/replies, xml ) Need Help??


in reply to Re: Simplest Possible Way To Disable Unicode
in thread Simplest Possible Way To Disable Unicode

I don't see when use bytes; would possibly be useful to solve this issue. Instead of print warning and returning the possibly useful UTF-8 encoding of the input, it simply destroys the high bits of the bad data.

$ perl -we'use bytes; $_ = chr(1000); print;' | od -t x1 0000000 e8 0000001 $ perl -we'use bytes; $_ = chr(232); print;' | od -t x1 0000000 e8 0000001

Whereas the original situation had a chance of providing something useful, this isn't the case with use bytes;. It possibly make things worse and hides the error.

Replies are listed 'Best First'.
Re^3: Simplest Possible Way To Disable Unicode
by tchrist (Pilgrim) on May 24, 2011 at 18:23 UTC
    I don't see when use bytes; would possibly be useful to solve this issue.
    Agreed. Itís not even clear to me what sort of problem it would solve.

    Iíve never been fond of od output myself. And you shouldnít need it, either. This tells the story clearly enough:

    % perl -wle 'print ord do { use bytes; chr(1000) }' 232 % perl -wle 'print ord do { use bytes; chr(232) }' 232 % perl -wle 'print ord do { no bytes; chr(1000) }' 1000

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others cooling their heels in the Monastery: (9)
As of 2021-04-14 15:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?