use utf8;
use re '/msx';
use open IO => ':encoding(utf-8)', ':std';
+use charnames ();
use JSON ();
use Data::Dump 'pp';
-our $VERSION = '1.01';
+our $VERSION = '1.02';
my $symname = eval {
open my $keysymh, '<', 'data/keysymdef.json' or die $!;
elsif (defined $symname->{$chr}) {
$chr = $symname->{$chr};
}
+ elsif ($chr eq 'NoSymbol') {
+ next;
+ }
else {
warn "unknown symbol $chr at $pos\n";
}
#$res{$pos}[$shift] = $symname->{$chr} // $chr; # geochar
}
}
-say pp(\%res) =~ s/(?<=") \\x \{? ([0-9A-F]{2,6}) \}?/chr hex $1/reg;
+say ppp(\%res);
+
+sub ppp {
+ local $_ = pp(@_);
+ s/(?<=") \\x \{? ([0-9A-F]{2,6}) \}?/chr hex $1/eg; # unescape glyphs
+ s/(\p{Mn})/sprintf '\N{%s}', charnames::viacode(ord $1)/eg; # named accents
+ return $_;
+}
+
__END__