Contrib: unicode2nginx compatibility with recent Perl versions.

In recent Perl versions unpack("C*") unpacks wide characters by default,
likely since perl 5.10 (seen at least in perl 5.20).  Replaced with
unpack("U0C*") instead to unpack bytes.

While here, improved style and updated my email.
This commit is contained in:
Maxim Dounin 2016-08-24 15:53:17 +03:00
parent 85b24c072f
commit 4c3245e3ec
1 changed files with 5 additions and 2 deletions

View File

@ -10,7 +10,7 @@
# Needs perl 5.6 or later.
# Written by Maxim Dounin, mdounin@rambler-co.ru
# Written by Maxim Dounin, mdounin@mdounin.ru
###############################################################################
@ -33,7 +33,10 @@ while (<>) {
# Produce UTF-8 sequence from character code;
my $un_utf8 = join('', map { sprintf("%02X", $_) } unpack("C*", pack("U", hex($un_code))));
my $un_utf8 = join('',
map { sprintf("%02X", $_) }
unpack("U0C*", pack("U", hex($un_code)))
);
print " $cs_code $un_utf8 ; $un_name\n";