#4 set LANG error

open
nobody
None
5
2003-04-18
2003-04-18
Navin
No

How to reproduce the bug
1) I assume that set LANG=hi_IN is default for all the
sessions or put set LANG=hi_IN in your .bash_profile or
.bashrc
else {
First on your xterm set LANG=hi_IN }
then ssh username@localhost then
set LANG=hi_IN
run the script iscii2utf8.pl on an iscii file
it says the below
Malformed UTF-8 character (overflow at 0x2c3130a9, byte
0x63, after start byte 0xbf) in pattern match (m//) at
small.pl line 17.
Malformed UTF-8 character (overflow at 0x2c3130a9, byte
0x63, after start byte 0xbf) in pattern match (m//) at
small.pl line 17.
Malformed UTF-8 character (overflow at 0x2c3130a9, byte
0x63, after start byte 0xbf) in pattern match (m//) at
small.pl line 17.
Malformed UTF-8 character (overflow at 0x2c3130a9, byte
0x63, after start byte 0xbf) in pattern match (m//) at
small.pl line 17.

Now unset LANG
then run the same script on the file it doesnot show
the Malformed character error.

Why are the error produced when the LANG is set ?
-------------------------------------------------------------------------------------------
iscii2utf8.pl
#! /usr/bin/perl
use strict;
my %devanagari = (
"r" => "l",
"a" => "b", # chandrabindu
"c" => "d",
"ac" => "m",
);

my $b = undef;
my $stash = "";
my $out = "";

while ((my $c = getc) ne undef) {
my $utf8 = undef;

if ($c =~ /[a-z]/) {
if ($b eq "") {
$out = $devanagari{$b.$c};
} else {
$out = $stash;
$stash = $devanagari{$c};
}
}

print $out;

$b = $c;
}

print $stash;

print "\n";
---------------------------------------------------------------------------------------------

Discussion

  • Navin
    Navin
    2003-04-18

    Logged In: YES
    user_id=756280

    I tried this on RedHat 8.0 and Mandrake 9.0