|Just another Perl shrine|
Simplest Possible Way To Disable Unicodeby JapanIsShinto (Initiate)
|on May 23, 2011 at 22:01 UTC||Need Help??|
JapanIsShinto has asked for the
wisdom of the Perl Monks concerning the following question:
I generate binary data from my Perl scripts. I do this by building up strings of yummy data that range from characters 0x00 to 0xFF. And I've been doing this for years without any problem.
Then, I get the bright idea to upgrade my Perl, and with it, I magically enter the world of Unicode. Maybe Unicode is great. Maybe one day it will make sense to me, and I'll appreciate it in all it's glory.
But not right now, please. Right now, I just want my scripts to work just like they worked in the past. Yeah, I'm sometimes on Windows and have to binmode() things. I'm used to that. But now when I do that, I get this:Wide character in syswrite at ...
I start to read and... OH MY GOD, IT'S FULL OF STARS. Or at least endless documentation that I'm sure is terribly fascinating, but which doesn't get me any closer to doing what I want.
So please, take pity on me. There must be some incantation I can put in my scripts that tells Perl that I want to pretend-- even if it's just for a little while-- that Unicode doesn't exist and I'm back in 2005 when life felt simpler.
Alternatively, knowing that I have code that merrily does things like this...my $image = chr(0xff) . pack('cN', $someThing, $otherThing);
... is there some minimally-invasive way to wrap the generation of such binary data so that when I syswrite it, I get good old-fashioned binary data out?