Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Simplest Possible Way To Disable Unicode

by (anonymized user) (Curate)
on May 24, 2011 at 15:09 UTC ( #906507=note: print w/replies, xml ) Need Help??


in reply to Simplest Possible Way To Disable Unicode

Assuming you are not yourself causing the packing of too much into a byte anywhere, in which case the warning is IMO fair, (like the chr(999) example cited), you could overload syswrite to unpack the data into bytes before invoking the real syswrite or failing that have a warning-free module that does nothing more than that.

One world, one people

  • Comment on Re: Simplest Possible Way To Disable Unicode

Replies are listed 'Best First'.
Re^2: Simplest Possible Way To Disable Unicode
by tchrist (Pilgrim) on May 24, 2011 at 19:08 UTC
    ... you could overload syswrite to unpack the data into bytes before invoking the real syswrite...
    Which is just what encoding layers exist for:
    % perl -C0 -we 'syswrite(STDOUT, chr(0x500), 1)' | wc -c Wide character in syswrite at -e line 1. 0 Exit 255 % perl -CS -we 'syswrite(STDOUT, chr(0xE9), 1)' | wc -c 2 % perl -CS -we 'syswrite(STDOUT, chr(0x1000), 1)' | wc -c 3 % perl -CS -we 'syswrite(STDOUT, chr(0x01_0000), 1)' | wc -c 4 % perl -CS -we 'syswrite(STDOUT, chr(0x0100_0000), 1)' | wc -c 5 % perl -CS -we 'syswrite(STDOUT, chr(0x1000_0000), 1)' | wc -c 6 % perl -CS -we 'syswrite(STDOUT, chr(0xF000_0000), 1)' | wc -c 7 % perl -CS -M-warnings=portable -we 'syswrite(STDOUT, chr(0x10_0000_00 +00), 1)' | wc -c 13

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (3)
As of 2021-04-18 00:32 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found

    Notices?