/usr/share/konwert/devel/mkcharset-charset is in konwert-dev 1.8-13.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | #!/usr/bin/perl
$plik_charsetA_utf8 = shift;
$plik_charsetB_utf8 = shift;
foreach (map chr, 32 .. 126) {$charsetB_utf8{$_} = $_}
if ($plik_charsetB_utf8 ne "ascii")
{
open CHARSETB_UTF8, $plik_charsetB_utf8;
while (<CHARSETB_UTF8>)
{
$charsetB_utf8{$2} = $1
if /^\t(\S+)\t(\S+)$/ && !exists $charsetB_utf8{$2};
}
close CHARSETB_UTF8;
}
%{$utf8_charsetB[1]{""}} = %charsetB_utf8;
open UTF8_CHARSET, shift;
while (<UTF8_CHARSET>)
{
@alt = split;
$utf8 = $alt[0];
@jest = ();
foreach (@alt)
{
$wariant = s/^((?:.|\\.)+)\\V(.+)$/$1/ ? $2 : "";
@znakiist = /[^\200-\377]|[\300-\377][\200-\277]+/g;
if (!grep {!exists $charsetB_utf8{$_}} @znakiist)
{
s/^((?:.|\\.)+)\\\}.*?$/$1/;
@znaki = /[^\200-\377]|[\300-\377][\200-\277]+/g;
$jeden = @znaki == 1 || /^\\[^!]$/;
unless
(
$jest[$jeden]{$wariant} ||
$jest[$jeden]{""} ||
$jest[1]{$wariant}
)
{
$utf8_charsetB[$jeden]{$wariant}{$utf8} =
join "", map {$charsetB_utf8{$_}} @znaki;
last if $jeden && $wariant eq "";
$jest[$jeden]{$wariant} = 1;
}
}
}
}
close UTF8_CHARSET;
$zastap = $utf8_charsetB[1]{""}{"\357\277\275"};
open CHARSETA_UTF8, $plik_charsetA_utf8;
while (<CHARSETA_UTF8>)
{
if (/^\t(\S+)\t(\S+)$/)
{
($A, $utf8) = ($1, $2);
foreach $jeden (0, 1)
{
foreach $wariant (keys %{$utf8_charsetB[$jeden]})
{
if (exists $utf8_charsetB[$jeden]{$wariant}{$utf8})
{
$charsetB_utf8[$jeden]{$wariant}
.= "\t$A\t$utf8_charsetB[$jeden]{$wariant}{$utf8}\n"
if $A ne $utf8_charsetB[$jeden]{$wariant}{$utf8}
|| $A ne $utf8_charsetB[1]{$wariant}{$utf8};
}
}
}
if (!exists $utf8_charsetB[1]{""}{$utf8})
{
if ($A =~ /^.|\\.$/)
{$brak .= $A}
else
{print "\t$A\t$zastap\n"}
}
}
}
close CHARSET1_UTF8;
sub apostrofy ($)
{
my ($tekst) = @_;
$tekst =~ s/'/'\\''/g;
return $tekst;
}
foreach $jeden (0, 1)
{
foreach $wariant (sort grep {$_ ne ""} keys %{$charsetB_utf8[$jeden]})
{
print "VARIANT${\(\"\",\"1\")[$jeden]}_$wariant='\n",
apostrofy $charsetB_utf8[$jeden]{$wariant}, "' ";
}
}
print "TRS='\n", apostrofy $charsetB_utf8[0]{""},
"' TRS1='\n", apostrofy $charsetB_utf8[1]{""};
print apostrofy "\\[$brak\\] $zastap\n" if $brak ne "";
print "'";
|