1#! /usr/bin/perl
2#
3# Copyright (c) 2001-2020, PostgreSQL Global Development Group
4#
5# src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl
6#
7# Generate UTF-8 <--> EUC_KR code 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 OLD5601.TXT from
12# the organization's ftp site.
13#
14# OLD5601.TXT format:
15#		 KSC5601 code in hex
16#		 UCS-2 code in hex
17#		 # and Unicode name (not used in this script)
18
19use strict;
20use warnings;
21
22use convutils;
23
24my $this_script = 'src/backend/utils/mb/Unicode/UCS_to_EUC_KR.pl';
25
26# Load the source file.
27
28my $mapping = &read_source("KSX1001.TXT");
29
30foreach my $i (@$mapping)
31{
32	$i->{code} = $i->{code} | 0x8080;
33}
34
35# Some extra characters that are not in KSX1001.TXT
36push @$mapping,
37  ( {
38		direction => BOTH,
39		ucs       => 0x20AC,
40		code      => 0xa2e6,
41		comment   => '# EURO SIGN',
42		f         => $this_script,
43		l         => __LINE__
44	},
45	{
46		direction => BOTH,
47		ucs       => 0x00AE,
48		code      => 0xa2e7,
49		comment   => '# REGISTERED SIGN',
50		f         => $this_script,
51		l         => __LINE__
52	},
53	{
54		direction => BOTH,
55		ucs       => 0x327E,
56		code      => 0xa2e8,
57		comment   => '# CIRCLED HANGUL IEUNG U',
58		f         => $this_script,
59		l         => __LINE__
60	});
61
62print_conversion_tables($this_script, "EUC_KR", $mapping);
63