T
Tulan W. Hu
My old perl code has the following that works in 5.6.0:
while($line = <STDIN>){
chomp $line;
$aline = $line;
($tline = $aline) =~ tr/\0-\x{ff}//UC;
printf STDERR ("%s\n", $tline);
}
I changed it for perl 5.8.0
while($line = <STDIN>){
chomp $line;
$aline = $line;
$pline = pack("C*", unpack("U*", $line));
printf STDOUT ("%s\n", $pline);
}
Both codes give me the same output if I use perl 5.6.0.
However, if I use perl 5.8.0, then the output is the same
as the input.
The code is converting utf8 to latin1.
I'm wondering which output is correct.
Thanks for your help in advance!
Tulan
while($line = <STDIN>){
chomp $line;
$aline = $line;
($tline = $aline) =~ tr/\0-\x{ff}//UC;
printf STDERR ("%s\n", $tline);
}
I changed it for perl 5.8.0
while($line = <STDIN>){
chomp $line;
$aline = $line;
$pline = pack("C*", unpack("U*", $line));
printf STDOUT ("%s\n", $pline);
}
Both codes give me the same output if I use perl 5.6.0.
However, if I use perl 5.8.0, then the output is the same
as the input.
The code is converting utf8 to latin1.
I'm wondering which output is correct.
Thanks for your help in advance!
Tulan