#!/usr/bin/perl # # Convert ".enc" file from the CStoCS package to UCS-2 character mapping # (c) 1997 Martin Mares # open (MAP, "cstocs-names") || die "No charname file"; while () { chop; ($c,$uni) = split /[ \t]+/; # if (defined $um{$uni}) { print "Warning: $uni redefined\n"; } $um{$uni} = $c; $code{$c} = $uni; } close MAP; while (<>) { chop; ($_,$c,$name) = split /[\t ]+/; if ($c >= 128) { if (!defined $code{$name}) { die "$name unknown"; } $u{$c} = $code{$name}; } } for ($i=0; $i<256; $i++) { $v = (defined $u{$i}) ? $u{$i} : ($i < 128 ? sprintf("%04X", $i) : "FFFD"); printf "%02X\t%s\n", $i, $v; }