]> mj.ucw.cz Git - libucw.git/commitdiff
fixed handling of characters lost by recoding
authorRobert Spalek <robert@ucw.cz>
Fri, 27 Jun 2003 12:39:50 +0000 (12:39 +0000)
committerRobert Spalek <robert@ucw.cz>
Fri, 27 Jun 2003 12:39:50 +0000 (12:39 +0000)
charset/misc/mkcharset

index b9275364672faeecd100482198864b7ba2c912cf..07b5a8549d5c51fe876dd15175560ee296c3f8e4 100755 (executable)
@@ -15,8 +15,8 @@ foreach $charset (@ARGV)
        while (<fi>)
        {
                chop;
-               (($number, $char) = /^([0-9A-F]{2})\t(.)$/) || die "Cannot parse $_";
-               $recode[hex $number] = ord $char;
+               (($number, $char) = /^([0-9A-F]{2})\t(.?)$/) || die "Cannot parse $_";
+               $recode[hex $number] = $char ne "" ? ord $char : -1;
        }
        $#recode >= 0 || die "Empty recoding table";
        $recode[10] = 10;
@@ -24,7 +24,8 @@ foreach $charset (@ARGV)
 
        for ($i=0; $i<=$#recode; $i++)
        {
-               printf fo "%02X\t%04X\n", $i, $recode[$i];
+               printf fo "%02X\t%04X\n", $i, $recode[$i]
+                       if $recode[$i] >= 0;
        }
 
        close(fo);