mirror of
https://github.com/nginx/nginx.git
synced 2024-11-24 18:00:18 -06:00
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:
parent
9208875db1
commit
0b97b1ec6f
@ -10,7 +10,7 @@
|
|||||||
|
|
||||||
# Needs perl 5.6 or later.
|
# 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;
|
# 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";
|
print " $cs_code $un_utf8 ; $un_name\n";
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user