diff options
| author | Pablo Martín Báez Echevarría | 2014-10-12 23:22:48 -0200 |
|---|---|---|
| committer | Pablo Martín Báez Echevarría | 2014-10-13 01:10:12 -0200 |
| commit | 66402f07d12c2a39bb88c063605e97a93e7fc9e7 (patch) | |
| tree | 58cafdce7ab7c5615da8a4ce48f632f047a36543 | |
| parent | f79b1a4f9ee0a04aac923a2687c089ad95711150 (diff) | |
| download | scripts.irssi.org-66402f07d12c2a39bb88c063605e97a93e7fc9e7.tar.bz2 | |
Update unicode.pl
| -rw-r--r-- | _data/scripts.yaml | 2 | ||||
| -rw-r--r-- | scripts/unicode.pl | 18 |
2 files changed, 18 insertions, 2 deletions
diff --git a/_data/scripts.yaml b/_data/scripts.yaml index 7d9ba96..d66517a 100644 --- a/_data/scripts.yaml +++ b/_data/scripts.yaml @@ -4219,7 +4219,7 @@ modified: "2014-07-06" license: "WTFPL" name: "unicode" - version: "1" + version: "2" - authors: "David Leadbeater" contact: "dgl@dgl.cx" diff --git a/scripts/unicode.pl b/scripts/unicode.pl index 01ff7bf..5970de4 100644 --- a/scripts/unicode.pl +++ b/scripts/unicode.pl @@ -14,7 +14,7 @@ use POSIX (); use Unicode::UCD qw(charblock charblocks charinfo); use Irssi qw(command_bind command_bind_first); -our $VERSION = "1"; +our $VERSION = "2"; our %IRSSI = ( authors => 'David Leadbeater', contact => 'dgl@dgl.cx', @@ -148,6 +148,13 @@ command_bind unicode => sub { } }; +sub hex_str { + my $str = shift; + use bytes; + my @raw_bytes = unpack('C*', $str); + return join('', map { '\\x'.sprintf("%02x", $_) } @raw_bytes); +} + sub print_info { my($character, $extra) = @_; my $info = charinfo $character; @@ -166,6 +173,7 @@ sub print_info { for(qw(decimal digit numeric upper lower title)) { $extra{$_} = $info->{$_} if $info->{$_}; } + $extra{"perl"} = hex_str(chr(hex $info->{code})); p " " x (7 + length $info->{code}), join(", ", map { "$_=$extra{$_}" } sort keys %extra); } } @@ -204,3 +212,11 @@ sub pipe_input { $pipe_in_progress = 0; $parent->($line); } + +command_bind charblocks => sub { + my $charblocks_hr = charblocks(); + my @blocks = sort keys %{$charblocks_hr}; + foreach(@blocks) { + Irssi::print($_,MSGLEVEL_CLIENTCRAP); + } +} |
