3 # Copyright (c) 2007-2022, PostgreSQL Global Development Group
5 # src/backend/utils/mb/Unicode/UCS_to_GB18030.pl
7 # Generate UTF-8 <--> UHC code conversion tables from
8 # "windows-949-2000.xml", obtained from
9 # http://source.icu-project.org/repos/icu/data/trunk/charset/data/xml/
11 # The lines we care about in the source file look like
12 # <a u="009A" b="81 30 83 36"/>
13 # where the "u" field is the Unicode code point in hex,
14 # and the "b" field is the hex byte sequence for UHC
21 my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_UHC.pl';
25 my $in_file = "windows-949-2000.xml";
27 open(my $in, '<', $in_file) || die("cannot open $in_file");
33 next if (!m/<a u="([0-9A-F]+)" b="([0-9A-F ]+)"/);
34 my ($u, $c) = ($1, $2);
39 next if ($code == 0x0080 || $code == 0x00FF);
41 if ($code >= 0x80 && $ucs >= 0x0080)
55 # One extra character that's not in the source file.
61 comment
=> 'CIRCLED HANGUL IEUNG U',
66 print_conversion_tables
($this_script, "UHC", \
@mapping);