From: Mischa POSLAWSKY Date: Tue, 21 Apr 2009 02:10:08 +0000 (+0000) Subject: charset: show unicode blocks requested by U$num X-Git-Tag: v1.3~166 X-Git-Url: http://git.shiar.nl/sheet.git/commitdiff_plain/2644a681f312e65a3f5e8c70d6dcf837931b51e8?ds=sidebyside charset: show unicode blocks requested by U$num --- diff --git a/charset.plp b/charset.plp index 41af494..91de26b 100644 --- a/charset.plp +++ b/charset.plp @@ -53,7 +53,15 @@ my @request = map { if ($input =~ s/-$//) { $endpoint = $row{offset} ? $row{offset} < 160 ? 159 : 191 : 127; } - if ($row{set} = resolve_alias($input)) { + + if ($input =~ /^U([0-9a-f]+)(?:-([0-9a-f]+))?/) { + my $start = hex($1) << ($2 ? 4 : 8); + my $end = $2 ? hex($2) << 4 : $start + 240; + $row{table} = join '', map { chr } $start .. $end+15; + utf8::upgrade($row{table}); # prevent latin1 output + $row{set} = sprintf 'Unicode block U+%02Xxx', $start >> 8; + } + elsif ($row{set} = resolve_alias($input)) { if ($row{set} eq 'Internal') { $row{table} = ' ' x ($endpoint < 255 ? 640 : 4096); $row{set} = 'Unicode BMP';