[nginx] Contrib: unicode2nginx compatibility with recent Perl versions.

Maxim Dounin mdounin at mdounin.ru
Wed Aug 24 12:54:23 UTC 2016


details:   http://hg.nginx.org/nginx/rev/8752257e883f
branches:  
changeset: 6665:8752257e883f
user:      Maxim Dounin <mdounin at mdounin.ru>
date:      Wed Aug 24 15:53:17 2016 +0300
description:
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.

diffstat:

 contrib/unicode2nginx/unicode-to-nginx.pl |  7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diffs (24 lines):

diff --git a/contrib/unicode2nginx/unicode-to-nginx.pl b/contrib/unicode2nginx/unicode-to-nginx.pl
--- 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 at rambler-co.ru
+# Written by Maxim Dounin, mdounin at 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";
 



More information about the nginx-devel mailing list