Debian Codegraph @

src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl

raw
1 #! /usr/bin/perl
2 #
3 # Copyright (c) 2001-2025, PostgreSQL Global Development Group
4 #
5 # src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl
6 #
7 # Generate UTF-8 <--> JOHAB conversion tables from
8 # map files provided by Unicode organization.
9 # Unfortunately it is prohibited by the organization
10 # to distribute the map files. So if you try to use this script,
11 # you have to obtain the map files from the organization's download site.
12 # https://www.unicode.org/Public/MAPPINGS/
13 # We assume the file include three tab-separated columns:
14 # JOHAB code in hex
15 # UCS-2 code in hex
16 # # and Unicode name (not used in this script)
17
18 use strict;
19 use warnings FATAL => 'all';
20
21 use convutils;
22
23 my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_JOHAB.pl';
24
25 # Load the source file.
26
27 my $mapping = &read_source("JOHAB.TXT");
28
29 # Some extra characters that are not in JOHAB.TXT
30 push @$mapping,
31 ( {
32 direction => BOTH,
33 ucs => 0x20AC,
34 code => 0xd9e6,
35 comment => '# EURO SIGN',
36 f => $this_script,
37 l => __LINE__
38 },
39 {
40 direction => BOTH,
41 ucs => 0x00AE,
42 code => 0xd9e7,
43 comment => '# REGISTERED SIGN',
44 f => $this_script,
45 l => __LINE__
46 },
47 {
48 direction => BOTH,
49 ucs => 0x327E,
50 code => 0xd9e8,
51 comment => '# CIRCLED HANGUL IEUNG U',
52 f => $this_script,
53 l => __LINE__
54 });
55
56 print_conversion_tables($this_script, "JOHAB", $mapping);