Mercurial > hg > nginx-quic
annotate contrib/unicode2nginx/unicode-to-nginx.pl @ 6862:abb0a4189cf7
Win32: compatiblity with OpenSSL 1.1.0.
OpenSSL 1.1.0 now uses normal "nmake; nmake install" instead of using
custom "ms\do_ms.bat" script and "ms\nt.mak" makefile. And Configure
now requires --prefix to be absolute, and no longer derives --openssldir
from prefix (so it's specified explicitly). Generated libraries are now
called "libcrypto.lib" and "libssl.lib" instead of "libeay32.lib"
and "ssleay32.lib". Appropriate tests added to support both old and new
variants.
Additionally, openssl/lhash.h now triggers warning C4090 ('function' :
different 'const' qualifiers), so the warning was disabled.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Sat, 24 Dec 2016 18:01:14 +0300 |
parents | 8752257e883f |
children |
rev | line source |
---|---|
667 | 1 #!/usr/bin/perl -w |
2 | |
3 # Convert unicode mappings to nginx configuration file format. | |
4 | |
5 # You may find useful mappings in various places, including | |
6 # unicode.org official site: | |
7 # | |
8 # http://www.unicode.org/Public/MAPPINGS/VENDORS/MICSFT/WINDOWS/CP1251.TXT | |
9 # http://www.unicode.org/Public/MAPPINGS/VENDORS/MISC/KOI8-R.TXT | |
10 | |
11 # Needs perl 5.6 or later. | |
12 | |
6665
8752257e883f
Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
667
diff
changeset
|
13 # Written by Maxim Dounin, mdounin@mdounin.ru |
667 | 14 |
15 ############################################################################### | |
16 | |
17 require 5.006; | |
18 | |
19 while (<>) { | |
20 # Skip comments and empty lines | |
21 | |
22 next if /^#/; | |
23 next if /^\s*$/; | |
24 chomp; | |
25 | |
26 # Convert mappings | |
27 | |
28 if (/^\s*0x(..)\s*0x(....)\s*(#.*)/) { | |
29 # Mapping <from-code> <unicode-code> "#" <unicode-name> | |
30 my $cs_code = $1; | |
31 my $un_code = $2; | |
32 my $un_name = $3; | |
33 | |
34 # Produce UTF-8 sequence from character code; | |
35 | |
6665
8752257e883f
Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
667
diff
changeset
|
36 my $un_utf8 = join('', |
8752257e883f
Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
667
diff
changeset
|
37 map { sprintf("%02X", $_) } |
8752257e883f
Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
667
diff
changeset
|
38 unpack("U0C*", pack("U", hex($un_code))) |
8752257e883f
Contrib: unicode2nginx compatibility with recent Perl versions.
Maxim Dounin <mdounin@mdounin.ru>
parents:
667
diff
changeset
|
39 ); |
667 | 40 |
41 print " $cs_code $un_utf8 ; $un_name\n"; | |
42 | |
43 } else { | |
44 warn "Unrecognized line: '$_'"; | |
45 } | |
46 } | |
47 | |
48 ############################################################################### |