Klaus Demo nginx / 0b97b1e
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. Maxim Dounin 4 years ago
1 changed file(s) with 5 addition(s) and 2 deletion(s). Raw diff Collapse all Expand all
99
1010 # Needs perl 5.6 or later.
1111
12 # Written by Maxim Dounin, mdounin@rambler-co.ru
12 # Written by Maxim Dounin, mdounin@mdounin.ru
1313
1414 ###############################################################################
1515
3232
3333 # Produce UTF-8 sequence from character code;
3434
35 my $un_utf8 = join('', map { sprintf("%02X", $_) } unpack("C*", pack("U", hex($un_code))));
35 my $un_utf8 = join('',
36 map { sprintf("%02X", $_) }
37 unpack("U0C*", pack("U", hex($un_code)))
38 );
3639
3740 print " $cs_code $un_utf8 ; $un_name\n";
3841