http://qs321.pair.com?node_id=906554


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

... 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