my @tablist = split m{/+}, $Request || 'default';
+use List::Util qw( first pairmap pairfirst pairs );
+
:>
-<h1>Character encoding</h1>
+<h1>Character encodings</h1>
+
+<p>
+<:
+if ($tablist[0] eq 'default') {
+ say "Overview of Unicode allocation and common latin code pages.";
+ say "Compare alternate charsets:";
+}
+else {
+ say "Charset comparison:";
+}
+
+sub optionlink {
+ my ($title, $href, $selected) = @_;
+ return sprintf(
+ $selected ? '<strong>%s</strong>' : '<a href="%2$s">%s</a>',
+ EscapeHTML($title), $href
+ );
+}
+
+print join " •\n", (
+ map {
+ join " ·\n", pairmap {
+ optionlink($b || ucfirst $a, "/charset/$a?compare", $a eq $Request);
+ } @{$_}
+ }
+ [
+ iso => 'ISO',
+ dos => 'DOS',
+ mac => 'Apple',
+ ebcdic => 'EBCDIC',
+ ],
+ [
+ westeur => 'West',
+ centeur => 'Central',
+ norteur => 'North European',
+ turkish => 0,
+ greek => 0,
+ cyrillic => 0,
+ hebrew => 0,
+ ],
+);
+:>.
+</p>
<:
use POSIX qw( ceil );
westeur => [qw( iso-8859-1 iso-8859-15 cp1252 iso-8859-14 cp850 hp-roman8 nextstep MacRoman )],
centeur => [qw( iso-8859-2 iso-8859-16 cp1250 cp852 MacRomanian MacCroatian MacCentralEurRoman )], # MacRumanian only for DB
turkish => [qw( iso-8859-9 iso-8859-3 cp1254 cp857 MacTurkish )],
+ norteur => [qw( baltic nordic )],
baltic => [qw( iso-8859-4 iso-8859-13 cp1257 cp775 )],
nordic => [qw( iso-8859-10 cp865 cp861 MacIcelandic MacSami )],
cyrillic => [qw( koi8-r koi8-u koi8-f iso-8859-5 cp1251 MacCyrillic cp866 cp855
my $params = $input =~ s/[+](.*)\z// ? $1 : undef;
if (not defined $params) {
- use List::Util qw( first pairfirst pairs );
-
state $INHERIT = {
'cp437' => ['cp850' => 0, 'ascii' => '0-31+128'], # ascii range overridden later
'gsm0338' => ['ascii' => '0-127'],
}
elsif (my $rows = int($len / $cols)) {
# multiple full rows
+ my $rowsize = $colsize * $cols;
if ($len -= $rows * $cols) {
# partial row remains
- $table->{$offset + $colsize*$rows * $cols} //= [$len*$colsize, "$class joinu", '', $title];
+ $table->{$offset + $rowsize * $rows} //= [$len*$colsize, "$class joinu", '', $title];
$class .= ' joind';
}
+
+ # coalesce multiple rows
+ while ($rows > 3) {
+ $info->{skip}->{$offset += $rowsize}++;
+ $rows--;
+ }
+ if ($rows > 2) {
+ $info->{skip}->{$offset += $rowsize} = 0;
+ }
+
$attr .= sprintf ' rowspan=%d', $rows;
$len = $cols;
}
}
print '<tr><th>';
- {
+ if (defined $row->{skip}->{$offset}) {
+ print '⋮';
+ }
+ else {
if (my $rowmod = $offset % $rowdiv) {
# offset in column units
printf '<small>+%X</small>', $rowmod;