/usr/share/konwert/devel/fixtrsutf8 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 | #!/usr/bin/perl
sub popraw ($$)
{
$_ = $_[1];
/([^\\]|\\[^[])*\\\[/g or return "$_[0]$_\n";
my $przed = $_[0] . substr ($_, 0, pos() - 2);
$_ = substr ($_, pos());
my %przedrostki = ();
until (/^\\\]/g)
{
if (/^()([^\\\200-\377]|\\.)/g
|| /^([\300-\337])([\200-\277])/g
|| /^([\340-\357][\200-\277])([\200-\277])/g)
{
$przedrostki{$1} .= $2;
$_ = substr ($_, pos());
}
else {die "Syntax error or bad UTF-8 at line $.\n"}
}
my $reszta = substr ($_, pos());
return map
{
popraw
(
"$przed$_" .
(
length $przedrostki{$_} == 1 ? $przedrostki{$_}
: "\\\[$przedrostki{$_}\\\]"
),
$reszta
)
}
sort keys %przedrostki
}
while (<>)
{
chomp;
print /^#/ ? "$_\n" : popraw ("", $_);
}
|