File: map8_txt2bin

package info (click to toggle)
libunicode-map8-perl 0.13%2Bdfsg-4
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, buster, jessie, jessie-kfreebsd, stretch
  • size: 1,012 kB
  • ctags: 83
  • sloc: perl: 495; ansic: 439; sh: 57; makefile: 2
file content (12 lines) | stat: -rwxr-xr-x 384 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
#!/usr/bin/perl -w

# This script converts a textual mapping file to a binary one.
# One reason that we do this is that we are not allowed to
# re-distribute the mapping provided by Unicode, Inc directly.

binmode(STDOUT);
print pack("nn", 0xFFFE, 0x0001);  # magic
while (<>) {
    next unless /^\s*0x([0-9A-Fa-f]{2})\s+0x([0-9A-Fa-f]{4})/;
    print pack("nn", hex($1), hex($2));
}