From 0b97b1ec6f1e6005e02c445c7716a1409052ff52 Mon Sep 17 00:00:00 2001 From: Maxim Dounin Date: Wed, 24 Aug 2016 15:53:17 +0300 Subject: [PATCH] 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. --- contrib/unicode2nginx/unicode-to-nginx.pl | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/contrib/unicode2nginx/unicode-to-nginx.pl b/contrib/unicode2nginx/unicode-to-nginx.pl index daaf354a8..d113fede4 100755 --- a/contrib/unicode2nginx/unicode-to-nginx.pl +++ b/contrib/unicode2nginx/unicode-to-nginx.pl @@ -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";