print STDERR "Assuming input coding system is ucs\@mcs.\n";
$in_cs='ucs@mcs';
}else{
- if(($opt_in_cs ne 'ucs@mcs')or
- ($opt_in_cs ne 'ucs@cns')or
- ($opt_in_cs ne 'ucs@gb')or
- ($opt_in_cs ne 'ucs@jis')or
- ($opt_in_cs ne 'ucs@ks')){
+ if(($opt_in_cs eq 'ucs@mcs')or
+ ($opt_in_cs eq 'ucs@cns')or
+ ($opt_in_cs eq 'ucs@gb')or
+ ($opt_in_cs eq 'ucs@jis')or
+ ($opt_in_cs eq 'ucs@ks')){
$in_cs=$opt_in_cs;
}else{
+ print STDERR "Invalid arguments.\n";
print STDERR $usage;
exit 1;
}
my($output_char);
if(&get_reverse_db("=$in_cs")){
- if($output_char=$reverse_chardb{"=$in_cs"}->{$char}){
+ if($output_char=$reverse_chardb{"=$in_cs"}->{unpack("U",$char)}){
$output_char=decode('utf8',$output_char) if($perl58);
- return $output_char=~s/^\?//;
+ $output_char=~s/^\?//;
+ return $output_char;
+ }else{
+ return $char;
}
}else{
return $char;