We're dependant on Perl for Unicode tables, so if it doesn't have a
recent enough set of definitions (e.g. Debian Stretch only has up to
Unicode 8) we were getting uninitialized value warnings for Unicode 9/10
characters. Fall back to outputting the hex value for the character.
Reported by Lars Wirzenius.
expand($server, $channel, $topic), $nick, $mask);
}
+sub expand_char {
+ my ($char) = @_;
+
+ my $name = charnames::viacode(ord $1);
+ $name = sprintf("{%X}", ord $1) unless defined($name);
+
+ return $name;
+}
+
sub expand {
my ($server, $target, $data) = @_;
$data = decode_utf8($data);
$data =~ s{([^\p{Letter}\p{Punctuation}\p{Control}\p{Space}\p{Sc}[:ascii:]])}{
- "${1} [".charnames::viacode(ord $1)."]"
+ "${1} [".expand_char($1)."]"
}ge;
return $data;