Debian Codegraph @

map8_txt2bin

raw
1 #!/usr/bin/perl -w
2
3 # This script converts a textual mapping file to a binary one.
4 # One reason that we do this is that we are not allowed to
5 # re-distribute the mapping provided by Unicode, Inc directly.
6
7 binmode(STDOUT);
8 print pack("nn", 0xFFFE, 0x0001); # magic
9 while (<>) {
10 next unless /^\s*0x([0-9A-Fa-f]{2})\s+0x([0-9A-Fa-f]{4})/;
11 print pack("nn", hex($1), hex($2));
12 }