perl-unicode

Is there a way to disable utf8 from inside the script?

2003-10-01 11:30:05
Greetings,

Apologies if this has been discussed ad nauseum before. I looked
at some previous perl-unicode messages on related topics, and tried a
few things I found there and on perldoc.com with no success. Here's
the deal:

OS: Linux Red Hat 8.0 (I didn't install it)
Perl: 5.8.0 (I didn't build it)
Data: GDS-2 layout database (a REAL binary file)

It seems there's a conspiracy between Red Hat 8 and Perl 5.8.0 where
Red Hat sets the LANG env var by default, and seeing that, Perl is
insisting that every file it opens be handled as Unicode. ;=( I don't
want Unicode. The data files give me the "Malformed Unicode Character"
message when I try to process them on Linux.

I know the most reliable way to avoid this is to "unsetenv LANG"
before running the script. I know I can check for this and make the
script "die" with the appropriate message. What I'm looking for is a
reliable way to disable utf8 after the script has already started so
I don't have to annoy all the users with this. I have already tried
all of the following with no joy:

use encoding "latin1";
use open ':encoding(raw)';
no utf8;

Etc. etc. Note that ":bytes" and "binmode" do nothing on Unix. This
is really frustrating. Any help would be appreciated.

Regards,

Simon Favre



<Prev in Thread] Current Thread [Next in Thread>