X-Git-Url: http://git.shiar.nl/sheet.git/blobdiff_plain/5cae8635fc2bb8b3d6cd7d2d954209dfdc78228f..d22e7febda8720bc38069f7061adb43b98143c48:/charset.plp diff --git a/charset.plp b/charset.plp index 6ec4a24..f9c50d8 100644 --- a/charset.plp +++ b/charset.plp @@ -5,7 +5,7 @@ my @tablist = split m{/+}, $Request || 'default'; Html({ title => 'charset cheat sheet', - version => '1.0', + version => '1.2', description => [ "Reference sheet with all glyphs in common character encoding tables,", "and an overview of Unicode ranges and UTF-8 bytes.", @@ -28,26 +28,25 @@ use List::Util qw( first pairmap pairfirst pairs );

<: +if ($tablist[0] eq 'unicode') { + say "Detailed allocation of Unicode blocks."; + print "See ", showlink("charsets", '/charset'), " to compare specific encodings"; +} +else { + if ($tablist[0] eq 'default') { - say "Overview of Unicode allocation and common latin code pages."; + say "Overview of Unicode ", showlink("allocation", '/charset/unicode'); + say "and common latin code pages."; say "Compare alternate charsets:"; } else { say "Charset comparison:"; } -sub optionlink { - my ($title, $href, $selected) = @_; - return sprintf( - $selected ? '%s' : '%s', - EscapeHTML($title), $href - ); -} - print join " •\n", ( map { join " ·\n", pairmap { - optionlink($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request); + showlink($b || ucfirst $a, '/charset'.($a && "/$a?compare"), $a eq $Request); } @{$_} } [ @@ -68,6 +67,8 @@ print join " •\n", ( hebrew => 0, ], ); + +} :>.

@@ -149,7 +150,9 @@ sub tabinput { } $row{endpoint} ||= 0xFF; - if ($row{set}) {} + if (defined $row{table} or defined $row{cell}) { + $row{set} //= $input; + } elsif ($row{set} = Encode::resolve_alias($input)) { $row{offset} = delete $row{startpoint}; if ($charset->{varchar}) { @@ -165,9 +168,7 @@ sub tabinput { } $row{endpoint} -= $row{offset}; - - $visible->{ascii} = # assume common base - $visible->{ $row{set} } = 1; + $visible->{ascii}++; # assume common base } else { Alert("Encoding $input unknown"); @@ -206,6 +207,7 @@ sub tabinput { } push @request, \%row; + $visible->{ $row{set} } = 1 if $row{table}; } tabinput($_) for @tablist; @@ -329,7 +331,7 @@ for my $row (@request) { my $cp = $offset + $row->{offset}; my $glyph = ref $row->{table} eq 'ARRAY' ? $row->{table}->[$offset] : substr $row->{table}, $offset, 1; - my ($cell, $name, $class) = $glyph eq $NOCHAR ? () : + my ($cell, $name, $class) = !defined $glyph || $glyph eq $NOCHAR ? () : $glyphs->glyph_html($glyph); if ($mode) { @@ -397,7 +399,7 @@ for my $row (@request) { -
unicode 7.0 + unicode 10.0 proposed deprecated unassigned