From b83f9b8cf8b93a1aab60a909970643c1d95e96dd Mon Sep 17 00:00:00 2001 From: Robert Spalek Date: Fri, 27 Jun 2003 12:27:49 +0000 Subject: [PATCH] added tools for stealing translation tables from recode sanity checks: - iso-8859-{1,2} tables are identical after extraction with the tables imported by MJ - cp1250 tables is quite different from the existing win-1250 table, but I do not know which one is right --- charset/misc/mkcharset | 32 ++++++++++++++++++++++++++++++++ charset/misc/mktab256 | 15 +++++++++++++++ 2 files changed, 47 insertions(+) create mode 100755 charset/misc/mkcharset create mode 100755 charset/misc/mktab256 diff --git a/charset/misc/mkcharset b/charset/misc/mkcharset new file mode 100755 index 00000000..b9275364 --- /dev/null +++ b/charset/misc/mkcharset @@ -0,0 +1,32 @@ +#!/usr/bin/perl +# +# Use `recode` to create a translation table +# (c) 2003, Robert Spalek +# + +use open IN => ":utf8"; + +foreach $charset (@ARGV) +{ + print "Charset: $charset\n"; + open(fi, "recode -s -f $charset/..utf-8/ tmp/$charset") || die; + + while () + { + chop; + (($number, $char) = /^([0-9A-F]{2})\t(.)$/) || die "Cannot parse $_"; + $recode[hex $number] = ord $char; + } + $#recode >= 0 || die "Empty recoding table"; + $recode[10] = 10; + $recode[13] = 13; + + for ($i=0; $i<=$#recode; $i++) + { + printf fo "%02X\t%04X\n", $i, $recode[$i]; + } + + close(fo); + close(fi); +} diff --git a/charset/misc/mktab256 b/charset/misc/mktab256 new file mode 100755 index 00000000..8cfc6e92 --- /dev/null +++ b/charset/misc/mktab256 @@ -0,0 +1,15 @@ +#!/usr/bin/perl +# +# Simply create a table of all 256 characters +# (c) 2003, Robert Spalek +# + +use open OUT => ":raw"; + +open(fo, '>tmp/tab256') || die; +for ($i=0; $i<256; $i++) +{ + next if $i==10 || $i==13; + printf fo "%02X\t%c\n", $i, $i; +} +close(fo); -- 2.39.2