dbk: Delete the `.check` file after the write test
[sunny256-utils.git] / h2chin
bloba4332c6e72acaf826f59a6dbf48d6936d552adfe
1 #!/usr/bin/env perl
3 # h2chin
4 # File ID: c9650f12-5d3a-11df-aa5c-90e6ba3022ac
5 # Konverterer fra numeriske entities til oversatt kinesisk.
7 use strict;
8 use warnings;
10 my %Uh;
12 $| = 1;
14 open(FromFP, "</tmp/Unihan-def.txt") || die("Klarte ikke å åpne unihan for lesing: $!");
15 while(<FromFP>) {
16 if (/^U\+(....)\s+kDefinition\s+(.*)/) {
17 $Uh{$1} = $2;
18 # print (STDERR "$1\n");
19 } else {
20 # print(STDERR "Bomma på $_\n");
24 close(FromFP);
26 while (<>) {
27 s!&#x([0-9A-F][0-9A-F][0-9A-F][0-9A-F]);!sprintf("\n[%s]", length($Uh{$1}) ? $Uh{$1} : join("", "U+", $1))!gei;
28 print;