+my %ALIAS = (
+# default => [qw(unicode utf-8 iso-8859-1 cp437 -cp1252- --iso-8859-15- -koi8-f)],
+ default => [qw(unicode- utf-8 iso-8859-1 -cp1252- --iso-8859-15- cp437 -cp850)],
+ 0 => [qw(cp437 cp863)],
+ 1 => [qw(iso-8859-1 cp1252 MacRoman cp850)],
+ 2 => [qw(iso-8859-2 cp1250 cp852 MacCentralEurRoman MacCroatian MacRumanian)],
+ 5 => [qw(koi8-f iso-8859-5 cp1251 MacCyrillic cp855 cp866)],
+ 7 => [qw(iso-8859-7 cp1253 MacGreek cp737 cp869)],
+ 8 => [qw(iso-8859-8 cp1255 MacHebrew cp862)],
+);
+my @request = map {
+ if (my $input = $_) {
+ my %row = (offset => 0);
+ my $endpoint = 255;
+ if ($input =~ s/^--//) {
+ $row{offset} = $endpoint > 160 ? 160 : 48;
+ }
+ elsif ($input =~ s/^-//) {
+ $row{offset} = $endpoint > 128 ? 128 : 32;
+ }
+ if ($input =~ s/-$//) {
+ $endpoint = $row{offset} ? $row{offset} < 160 ? 159 : 191 : 127;
+ }
+ if ($row{set} = resolve_alias($input)) {
+ if ($row{set} eq 'Internal') {
+ $row{table} = ' ' x ($endpoint < 255 ? 640 : 4096);
+ $row{set} = 'Unicode BMP';
+ $row{cell} = do 'charset-unicode.inc.pl';
+ }
+ elsif ($row{set} eq 'utf-8-strict') {
+ $row{table} = undef;
+ $row{set} = 'UTF-8';
+ $row{cell} = do 'charset-utf8.inc.pl';
+ }
+ else {
+ $row{table} = decode($row{set}, pack 'C*', $row{offset} .. $endpoint);
+ }
+ }
+ else {
+ print "<p>Encoding $input unknown</p>\n";
+ }
+ \%row;
+ }
+ else {
+ ();
+ }
+} map { defined $ALIAS{$_} ? @{ $ALIAS{$_} } : $_ }
+ $ENV{PATH_INFO} =~ /\w/ ? split(m{[/+\s]}, $ENV{PATH_INFO}) : 'default';