~ubuntu-branches/ubuntu/natty/ibm-3270/natty

« back to all changes in this revision

Viewing changes to x3270/unicode.c

  • Committer: Bazaar Package Importer
  • Author(s): Bastian Blank
  • Date: 2009-12-14 11:48:53 UTC
  • mfrom: (1.1.4 upstream) (2.1.2 sid)
  • Revision ID: james.westby@ubuntu.com-20091214114853-mywixml32hct9jr1
Tags: 3.3.10ga4-2
* Fix section to match override.
* Use debhelper compat level 7.
* Use 3.0 (quilt) source format.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/*
 
2
 * Copyright (c) 2008-2009, Paul Mattes.
 
3
 * All rights reserved.
 
4
 *
 
5
 * Redistribution and use in source and binary forms, with or without
 
6
 * modification, are permitted provided that the following conditions are met:
 
7
 *     * Redistributions of source code must retain the above copyright
 
8
 *       notice, this list of conditions and the following disclaimer.
 
9
 *     * Redistributions in binary form must reproduce the above copyright
 
10
 *       notice, this list of conditions and the following disclaimer in the
 
11
 *       documentation and/or other materials provided with the distribution.
 
12
 *     * Neither the names of Paul Mattes nor the names of his contributors
 
13
 *       may be used to endorse or promote products derived from this software
 
14
 *       without specific prior written permission.
 
15
 *
 
16
 * THIS SOFTWARE IS PROVIDED BY PAUL MATTES "AS IS" AND ANY EXPRESS OR IMPLIED
 
17
 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
 
18
 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
 
19
 * EVENT SHALL PAUL MATTES BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
 
20
 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
 
21
 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
 
22
 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
 
23
 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
 
24
 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
 
25
 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 
26
 */
 
27
 
 
28
/*
 
29
 *      unicode.c
 
30
 *              A Windows console-based 3270 Terminal Emulator
 
31
 *              EBCDIC/Unicode translation functions
 
32
 */
 
33
#include "globals.h"
 
34
#include <stdio.h>
 
35
#if !defined(_MSC_VER) /*[*/
 
36
#include <strings.h>
 
37
#endif /*]*/
 
38
#include <errno.h>
 
39
#include "3270ds.h"
 
40
#if !defined(PR3287) /*[*/
 
41
#include "appres.h"
 
42
#endif /*]*/
 
43
#include "unicodec.h"
 
44
#include "unicode_dbcsc.h"
 
45
#include "utf8c.h"
 
46
#if !defined(PR3287) /*[*/
 
47
#include "utilc.h"
 
48
#endif /*]*/
 
49
 
 
50
#if defined(_WIN32) /*[*/
 
51
#include <windows.h>
 
52
#endif /*]*/
 
53
 
 
54
#if defined(USE_ICONV) /*[*/
 
55
iconv_t i_u2mb = (iconv_t)-1;
 
56
iconv_t i_mb2u = (iconv_t)-1;
 
57
#if !defined(_LIBICONV_VERSION) || _LIBICONV_VERSION < 0x0108 /*[*/
 
58
typedef char *ici_t;            /* old iconv */
 
59
#else /*][*/
 
60
typedef const char *ici_t;      /* new iconv */
 
61
#endif /*]*/
 
62
#endif /*]*/
 
63
 
 
64
#define DEFAULT_CSNAME  "us"
 
65
 
 
66
#if defined(_WIN32) /*[*/
 
67
# if defined(WS3270) /*[*/
 
68
#  define LOCAL_CODEPAGE        appres.local_cp
 
69
# else /*[*/
 
70
#  define LOCAL_CODEPAGE        CP_ACP
 
71
# endif /*]*/
 
72
#endif /*]*/
 
73
 
 
74
/*
 
75
 * EBCDIC-to-Unicode translation tables.
 
76
 * Each table maps EBCDIC codes X'41' through X'FE' to UCS-2.
 
77
 * Other codes are mapped programmatically.
 
78
 */
 
79
#define UT_SIZE         190
 
80
#define UT_OFFSET       0x41
 
81
 
 
82
typedef struct {
 
83
    char *name;
 
84
    unsigned short code[UT_SIZE];
 
85
    const char *host_codepage;
 
86
    const char *cgcsgid;
 
87
    const char *display_charset;
 
88
} uni_t;
 
89
 
 
90
static uni_t uni[] = {
 
91
{ "cp037", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x005e, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005b, 0x005d, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da },  "37", "37", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
92
{ "cp273", { 0x00a0, 0x00e2, 0x007b, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00c4, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x007e, 0x00dc, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x005b, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00f6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x00a7, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x00df, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x0040, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e4, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00a6, 0x00f2, 0x00f3, 0x00f5, 0x00fc, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x007d, 0x00f9, 0x00fa, 0x00ff, 0x00d6, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x005c, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x005d, 0x00d9, 0x00da }, "273", "273", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
93
{ "cp275", { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00c9, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0024, 0x00c7, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00e7, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00e3, 0x003a, 0x00d5, 0x00c3, 0x0027, 0x003d, 0x0022, 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00f5, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00e9, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005c, 0x0000, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, "275", "275", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1"  },
 
94
{ "cp277", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x007d, 0x00e7, 0x00f1, 0x0023, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x00a4, 0x00c5, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x0024, 0x00c7, 0x00d1, 0x00f8, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00a6, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x00c6, 0x00d8, 0x0027, 0x003d, 0x0022, 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x007b, 0x00b8, 0x005b, 0x005d, 0x00b5, 0x00fc, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e6, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x00e5, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x007e, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "277", "277", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1"  },
 
95
{ "cp278", { 0x00a0, 0x00e2, 0x007b, 0x00e0, 0x00e1, 0x00e3, 0x007d, 0x00e7, 0x00f1, 0x00a7, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x0060, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x00a4, 0x00c5, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x0023, 0x00c0, 0x00c1, 0x00c3, 0x0024, 0x00c7, 0x00d1, 0x00f6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00e9, 0x003a, 0x00c4, 0x00d6, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x005d, 0x00b5, 0x00fc, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x005b, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e4, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00a6, 0x00f2, 0x00f3, 0x00f5, 0x00e5, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x007e, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x0040, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "278", "278", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
96
{ "cp280", { 0x00a0, 0x00e2, 0x00e4, 0x007b, 0x00e1, 0x00e3, 0x00e5, 0x005c, 0x00f1, 0x00b0, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x005d, 0x00ea, 0x00eb, 0x007d, 0x00ed, 0x00ee, 0x00ef, 0x007e, 0x00df, 0x00e9, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00f2, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00f9, 0x003a, 0x00a3, 0x00a7, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x005b, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x00ec, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x0023, 0x00a5, 0x00b7, 0x00a9, 0x0040, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e0, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00a6, 0x00f3, 0x00f5, 0x00e8, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x0060, 0x00fa, 0x00ff, 0x00e7, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "280", "280", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
97
{ "cp284", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00a6, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x0023, 0x00f1, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x00d1, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x00a8, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005e, 0x0021, 0x00af, 0x007e, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "284", "284", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
98
{ "cp285", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x0024, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x00a3, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x00af, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x005b, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005e, 0x005d, 0x007e, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "285", "285", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
99
{ "cp297", { 0x00a0, 0x00e2, 0x00e4, 0x0040, 0x00e1, 0x00e3, 0x00e5, 0x005c, 0x00f1, 0x00b0, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x007b, 0x00ea, 0x00eb, 0x007d, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x00a7, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00f9, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00b5, 0x003a, 0x00a3, 0x00e0, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x005b, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x0060, 0x00a8, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x0023, 0x00a5, 0x00b7, 0x00a9, 0x005d, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x007e, 0x00b4, 0x00d7, 0x00e9, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x00e8, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00a6, 0x00fa, 0x00ff, 0x00e7, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "297", "297", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
100
{ "cp424", { 0x5d0, 0x05d1, 0x05d2, 0x05d3, 0x05d4, 0x05d5, 0x05d6, 0x05d7, 0x05d8, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x05d9, 0x05da, 0x05db, 0x05dc, 0x05dd, 0x05de, 0x05df, 0x05e0, 0x05e1, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x05e2, 0x05e3, 0x05e4, 0x05e5, 0x05e6, 0x05e7, 0x05e8, 0x05e9, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x0000, 0x05ea, 0x0000, 0x0000, 0x00a0, 0x0000, 0x0000, 0x0000, 0x21d4, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x0000, 0x0000, 0x0000, 0x0000, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0000, 0x0000, 0x0000, 0x00b8, 0x0000, 0x00a4, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00ae, 0x005e, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005b, 0x005d, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x0000, 0x0000, 0x0000, 0x0000 }, "424", "0x03ad01a8", "3270cg-8,iso10646-1,iso8859-8" },
 
101
{ "cp500", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "500", "500", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
102
{ "cp870", { 0x00a0, 0x00e2, 0x00e4, 0x0163, 0x00e1, 0x0103, 0x010d, 0x00e7, 0x0107, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x0119, 0x00eb, 0x016f, 0x00ed, 0x00ee, 0x013e, 0x013a, 0x00df, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x02dd, 0x00c1, 0x0102, 0x010c, 0x00c7, 0x0106, 0x007c, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x02c7, 0x00c9, 0x0118, 0x00cb, 0x016e, 0x00cd, 0x00ce, 0x013d, 0x0139, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x02d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x015b, 0x0148, 0x0111, 0x00fd, 0x0159, 0x015f, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0142, 0x0144, 0x0161, 0x00b8, 0x02db, 0x00a4, 0x0105, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x015a, 0x0147, 0x0110, 0x00dd, 0x0158, 0x015e, 0x00b7, 0x0104, 0x017c, 0x0162, 0x017b, 0x00a7, 0x017e, 0x017a, 0x017d, 0x0179, 0x0141, 0x0143, 0x0160, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x0155, 0x00f3, 0x0151, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x011a, 0x0171, 0x00fc, 0x0165, 0x00fa, 0x011b, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x010f, 0x00d4, 0x00d6, 0x0154, 0x00d3, 0x0150, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x010e, 0x0170, 0x00dc, 0x0164, 0x00da }, "870", "0x03bf0366", "iso10646-1,iso8859-2" },
 
103
{ "cp871", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00fe, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x00c6, 0x0024, 0x002a, 0x0029, 0x003b, 0x00d6, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00f0, 0x003a, 0x0023, 0x00d0, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x0060, 0x00fd, 0x007b, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x007d, 0x00b8, 0x005d, 0x00a4, 0x00b5, 0x00f6, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x0040, 0x00dd, 0x005b, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x005c, 0x00d7, 0x00de, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x007e, 0x00f2, 0x00f3, 0x00f5, 0x00e6, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x00b4, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x005e, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "871", "871", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
104
{ "cp875", { 0x0391, 0x0392, 0x0393, 0x0394, 0x0395, 0x0396, 0x0397, 0x0398, 0x0399, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x039a, 0x039b, 0x039c, 0x039d, 0x039e, 0x039f, 0x03a0, 0x03a1, 0x03a3, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x03a4, 0x03a5, 0x03a6, 0x03a7, 0x03a8, 0x03a9, 0x03aa, 0x03ab, 0x0000, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00a8, 0x0386, 0x0388, 0x0389, 0x2207, 0x038a, 0x038c, 0x038e, 0x038f, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0385, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x03b1, 0x03b2, 0x03b3, 0x03b4, 0x03b5, 0x03b6, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x03b7, 0x03b8, 0x03b9, 0x03ba, 0x03bb, 0x03bc, 0x00b4, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x03bd, 0x03be, 0x03bf, 0x03c0, 0x03c1, 0x03c3, 0x00a3, 0x03ac, 0x03ad, 0x03ae, 0x0390, 0x03af, 0x03cc, 0x03cd, 0x03b0, 0x03ce, 0x03c2, 0x03c4, 0x03c5, 0x03c6, 0x03c7, 0x03c8, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x03c9, 0x03ca, 0x03cb, 0x2018, 0x2015, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b1, 0x00bd, 0x0000, 0x00b7, 0x2019, 0x00a6, 0x005c, 0x0000, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00a7, 0x0000, 0x0000, 0x00ab, 0x00ac, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00a9, 0x0000, 0x0000, 0x00bb }, "875", "0x0464036b", "3270cg-7,iso10646-1,iso8859-7" },
 
105
{ "cp880", { 0x0000, 0x0452, 0x0453, 0x0451, 0x0000, 0x0455, 0x0456, 0x0457, 0x0458, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x0459, 0x045a, 0x045b, 0x045c, 0x0000, 0x045f, 0x042a, 0x2116, 0x0402, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x0403, 0x0401, 0x0000, 0x0405, 0x0406, 0x0407, 0x0408, 0x0409, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x040a, 0x040b, 0x040c, 0x0000, 0x0000, 0x040f, 0x044e, 0x0430, 0x0431, 0x0000, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0446, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x0434, 0x0435, 0x0444, 0x0433, 0x0445, 0x0438, 0x0439, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x043a, 0x043b, 0x043c, 0x043d, 0x043e, 0x043f, 0x044f, 0x0000, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0440, 0x0441, 0x0442, 0x0443, 0x0436, 0x0432, 0x044c, 0x044b, 0x0437, 0x0448, 0x044d, 0x0449, 0x0447, 0x044a, 0x042e, 0x0410, 0x0411, 0x0426, 0x0414, 0x0415, 0x0424, 0x0413, 0x0000, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x0425, 0x0418, 0x0419, 0x041a, 0x041b, 0x041c, 0x0000, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x041d, 0x041e, 0x041f, 0x042f, 0x0420, 0x0421, 0x005c, 0x00a4, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x0422, 0x0423, 0x0416, 0x0412, 0x042c, 0x042b, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x0417, 0x0428, 0x042d, 0x0429, 0x0427 }, "880", "0x03bf0370", "iso10646-1,koi8-r" },
 
106
#if defined(X3270_DBCS) /*[*/
 
107
{ "cp930", {
 
108
 /* 0x40 */         0xff61, 0xff62, 0xff63, 0xff64, 0xff65, 0xff66, 0xff67,
 
109
 /* 0x48 */ 0xff68, 0xff69, 0x00a3, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c,
 
110
 /* 0x50 */ 0x0026, 0xff6a, 0xff6b, 0xff6c, 0xff6d, 0xff6e, 0xff6f, 0x0000,
 
111
 /* 0x58 */ 0xff70, 0x0000, 0x0021, 0x00a5, 0x002a, 0x0029, 0x003b, 0x00ac,
 
112
 /* 0x60 */ 0x002d, 0x002f, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066,
 
113
 /* 0x68 */ 0x0067, 0x0068, 0x0000, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f,
 
114
 /* 0x70 */ 0x005b, 0x0069, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f,
 
115
 /* 0x78 */ 0x0070, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022,
 
116
 /* 0x80 */ 0x005d, 0xff67, 0xff68, 0xff73, 0xff74, 0xff75, 0xff76, 0xff77,
 
117
 /* 0x88 */ 0xff78, 0xff79, 0xff7a, 0x0071, 0xff7b, 0xff7c, 0xff7d, 0xff7e,
 
118
 /* 0x90 */ 0xff7f, 0xff80, 0xff81, 0xff82, 0xff83, 0xff84, 0xff85, 0xff86,
 
119
 /* 0x98 */ 0xff87, 0xff88, 0xff89, 0x0072, 0x0000, 0xff8a, 0xff8b, 0xff8c,
 
120
 /* 0xa0 */ 0x007e, 0x00af, 0xff8d, 0xff8e, 0xff8f, 0xff90, 0xff91, 0xff92,
 
121
 /* 0xa8 */ 0xff93, 0xff94, 0xff95, 0x0073, 0xff96, 0xff97, 0xff98, 0xff99,
 
122
 /* 0xb0 */ 0x005e, 0x00a2, 0x005c, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078,
 
123
 /* 0xb8 */ 0x0079, 0x007a, 0xff9a, 0xff9b, 0xff9c, 0xff9d, 0xff9e, 0xff9f,
 
124
 /* 0xc0 */ 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
 
125
 /* 0xc8 */ 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
126
 /* 0xd0 */ 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
 
127
 /* 0xd8 */ 0x0051, 0x0052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
128
 /* 0xe0 */ 0x0024, 0x20ac, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
 
129
 /* 0xe8 */ 0x0059, 0x005a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
130
 /* 0xf0 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
 
131
 /* 0xf8 */ 0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
 
132
   } , "930", "0x04940122" /* 1172, 0290 */, "iso10646-1,jisx0201.1976-0" },
 
133
{ "cp935", { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a3, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0021, 0x00a5, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007e, 0x00af, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005e, 0x0000, 0x005c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005b, 0x005d, 0x0000, 0x0000, 0x0000, 0x0000, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0024, 0x0000, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },  "935", "0x04960344" /* 1174, 836 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
134
{ "cp937", { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005e, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005b, 0x005d, 0x0000, 0x0000, 0x0000, 0x0000, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005c, 0x0000, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, "937", "0x04970025" /* 1175, 037 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
135
{ "cp939", {
 
136
    /* 40 */         0x0000, 0xff61, 0xff62, 0xff63, 0xff64, 0xff65, 0xff66,
 
137
    /* 48 */ 0xff67, 0xff68, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c,
 
138
    /* 50 */ 0x0026, 0xff69, 0xff6a, 0xff6b, 0xff6c, 0xff6d, 0xff6e, 0xff6f,
 
139
    /* 58 */ 0xff70, 0xff71, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac,
 
140
    /* 60 */ 0x002d, 0x002f, 0xff72, 0xff73, 0xff74, 0xff75, 0xff76, 0xff77,
 
141
    /* 68 */ 0xff78, 0xff79, 0x0000, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f,
 
142
    /* 70 */ 0xff7a, 0xff7b, 0xff7c, 0xff7d, 0xff7e, 0xff7f, 0xff80, 0xff81,
 
143
    /* 78 */ 0xff82, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022,
 
144
    /* 80 */ 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067,
 
145
    /* 88 */ 0x0068, 0x0069, 0xff83, 0xff84, 0xff85, 0xff86, 0xff87, 0xff88,
 
146
    /* 90 */ 0x0000, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070,
 
147
    /* 98 */ 0x0071, 0x0072, 0xff89, 0xff8a, 0xff8b, 0xff8c, 0xff8d, 0xff8e,
 
148
    /* a0 */ 0x00af, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078,
 
149
    /* a8 */ 0x0079, 0x007a, 0xff8f, 0xff90, 0xff91, 0x005b, 0xff92, 0xff93,
 
150
    /* b0 */ 0x005e, 0x00a3, 0x00a5, 0xff94, 0xff95, 0xff96, 0xff97, 0xff98,
 
151
    /* b8 */ 0xff99, 0xff9a, 0xff9b, 0xff9c, 0xff9d, 0x005d, 0xff9e, 0xff9f,
 
152
    /* c0 */ 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047,
 
153
    /* c8 */ 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
154
    /* d0 */ 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050,
 
155
    /* d8 */ 0x0051, 0x0052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
156
    /* e0 */ 0x005c, 0x20ac, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058,
 
157
    /* e8 */ 0x0059, 0x005a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
158
    /* f0 */ 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037,
 
159
    /* f8 */ 0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 },
 
160
        "939", "0x04940403" /* 1172, 1027 */, "iso10646-1,jisx0201.1976-0" },
 
161
#endif /*]*/
 
162
{ "cp1026", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x007b, 0x00f1, 0x00c7, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x011e, 0x0130, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x005b, 0x00d1, 0x015f, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0131, 0x003a, 0x00d6, 0x015e, 0x0027, 0x003d, 0x00dc, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x007d, 0x0060, 0x00a6, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x02db, 0x00c6, 0x00a4, 0x00b5, 0x00f6, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x005d, 0x0024, 0x0040, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x2014, 0x00a8, 0x00b4, 0x00d7, 0x00e7, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x007e, 0x00f2, 0x00f3, 0x00f5, 0x011f, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x005c, 0x00f9, 0x00fa, 0x00ff, 0x00fc, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x0023, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x0022, 0x00d9, 0x00da }, "1026", "0x04800402", "iso10646-1,iso8859-9" },
 
163
{ "cp1047", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x005b, 0x00de, 0x00ae, 0x00ac, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00dd, 0x00a8, 0x00af, 0x005d, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1047", "1047", "iso10646-1,iso8859-1" },
 
164
{ "cp1140", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x005e, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005b, 0x005d, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1140", "0x02b70474" /* 695, 1140 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
165
{ "cp1141", { 0x00a0, 0x00e2, 0x007b, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00c4, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x007e, 0x00dc, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x005b, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00f6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x00a7, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x00b5, 0x00df, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x0040, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e4, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00a6, 0x00f2, 0x00f3, 0x00f5, 0x00fc, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x007d, 0x00f9, 0x00fa, 0x00ff, 0x00d6, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x005c, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x005d, 0x00d9, 0x00da }, "1141", "0x02b70475" /* 695, 1141 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
166
{ "cp1142", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x007d, 0x00e7, 0x00f1, 0x0023, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x20ac, 0x00c5, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x0024, 0x00c7, 0x00d1, 0x00f8, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00a6, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x00c6, 0x00d8, 0x0027, 0x003d, 0x0022, 0x0040, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x007b, 0x00b8, 0x005b, 0x005d, 0x00b5, 0x00fc, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e6, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x00e5, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x007e, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1142", "0x02b70476" /* 695, 1142 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
167
{ "cp1143", { 0x00a0, 0x00e2, 0x007b, 0x00e0, 0x00e1, 0x00e3, 0x007d, 0x00e7, 0x00f1, 0x00a7, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x0060, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x20ac, 0x00c5, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x0023, 0x00c0, 0x00c1, 0x00c3, 0x0024, 0x00c7, 0x00d1, 0x00f6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x005c, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00e9, 0x003a, 0x00c4, 0x00d6, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x005d, 0x00b5, 0x00fc, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x005b, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e4, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00a6, 0x00f2, 0x00f3, 0x00f5, 0x00e5, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x007e, 0x00f9, 0x00fa, 0x00ff, 0x00c9, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x0040, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1143", "0x02b70477" /* 695, 1143 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
168
{ "cp1144", { 0x00a0, 0x00e2, 0x00e4, 0x007b, 0x00e1, 0x00e3, 0x00e5, 0x005c, 0x00f1, 0x00b0, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x005d, 0x00ea, 0x00eb, 0x007d, 0x00ed, 0x00ee, 0x00ef, 0x007e, 0x00df, 0x00e9, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00f2, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00f9, 0x003a, 0x00a3, 0x00a7, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x005b, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x00b5, 0x00ec, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x0023, 0x00a5, 0x00b7, 0x00a9, 0x0040, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x00e0, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00a6, 0x00f3, 0x00f5, 0x00e8, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x0060, 0x00fa, 0x00ff, 0x00e7, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1144", "0x02b70478" /* 695, 1144 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
169
{ "cp1145", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00a6, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x0023, 0x00f1, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x00d1, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x00b5, 0x00a8, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005e, 0x0021, 0x00af, 0x007e, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1145", "0x02b70478" /* 695, 1145 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
170
{ "cp1146", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x0024, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x00a3, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x00b5, 0x00af, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x005b, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005e, 0x005d, 0x007e, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1146", "0x02b7047a" /* 695, 1146 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
171
{ "cp1147", { 0x00a0, 0x00e2, 0x00e4, 0x0040, 0x00e1, 0x00e3, 0x00e5, 0x005c, 0x00f1, 0x00b0, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x007b, 0x00ea, 0x00eb, 0x007d, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x00a7, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00f9, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00b5, 0x003a, 0x00a3, 0x00e0, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x005b, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x0060, 0x00a8, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x0023, 0x00a5, 0x00b7, 0x00a9, 0x005d, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x007e, 0x00b4, 0x00d7, 0x00e9, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x00e8, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00a6, 0x00fa, 0x00ff, 0x00e7, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1147", "0x02b7047a" /* 695, 1147 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
172
{ "cp1148", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x005b, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x005d, 0x0024, 0x002a, 0x0029, 0x003b, 0x005e, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x20ac, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1148", "0x02b7047c" /* 695, 1148 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
173
{ "cp1149", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00de, 0x002e, 0x003c, 0x0028, 0x002b, 0x0021, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x00c6, 0x0024, 0x002a, 0x0029, 0x003b, 0x00d6, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x00f0, 0x003a, 0x0023, 0x00d0, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x0060, 0x00fd, 0x007b, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x007d, 0x00b8, 0x005d, 0x20ac, 0x00b5, 0x00f6, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x0040, 0x00dd, 0x005b, 0x00ae, 0x00a2, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00ac, 0x007c, 0x00af, 0x00a8, 0x005c, 0x00d7, 0x00fe, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x007e, 0x00f2, 0x00f3, 0x00f5, 0x00e6, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x00b4, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x005e, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "1149", "0x02b7047d" /* 695, 1149 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-15" },
 
174
{ "cp1160", { 0x00a0, 0x0e01, 0x0e02, 0x0e03, 0x0e04, 0x0e05, 0x0e06, 0x0e07, 0x005b, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x0e48, 0x0e08, 0x0e09, 0x0e0a, 0x0e0b, 0x0e0c, 0x0e0d, 0x0e0e, 0x005d, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x0e0f, 0x0e10, 0x0e11, 0x0e12, 0x0e13, 0x0e14, 0x0e15, 0x005e, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x0e3f, 0x0e4e, 0x0e16, 0x0e17, 0x0e18, 0x0e19, 0x0e1a, 0x0e1b, 0x0e1c, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0e4f, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x0e1d, 0x0e1e, 0x0e1f, 0x0e20, 0x0e21, 0x0e22, 0x0e5a, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0e23, 0x0e24, 0x0e25, 0x0e26, 0x0e27, 0x0e28, 0x0e5b, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0e29, 0x0e2a, 0x0e2b, 0x0e2c, 0x0e2d, 0x0e2e, 0x0e50, 0x0e51, 0x0e52, 0x0e53, 0x0e54, 0x0e55, 0x0e56, 0x0e57, 0x0e58, 0x0e59, 0x0e2f, 0x0e30, 0x0e31, 0x0e32, 0x0e33, 0x0e34, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x0e49, 0x0e35, 0x0e36, 0x0e37, 0x0e38, 0x0e39, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0e3a, 0x0e40, 0x0e41, 0x0e42, 0x0e43, 0x0e44, 0x005c, 0x0e4a, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x0e45, 0x0e46, 0x0e47, 0x0e48, 0x0e49, 0x0e4a, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x0e4b, 0x0e4c, 0x0e4d, 0x0e4b, 0x20ac }, "1160", "0x05730488" /* 1395, 1160 */, "iso10646-1,iso8859-11" },
 
175
#if defined(X3270_DBCS) /*[*/
 
176
{ "cp1388", { 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a3, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0021, 0x00a5, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x0000, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007e, 0x00af, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005e, 0x0000, 0x005c, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005b, 0x005d, 0x0000, 0x0000, 0x0000, 0x0000, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0024, 0x0000, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000 }, "1388", "0x04960344" /* 1174, 836 */, "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
177
#endif /*]*/
 
178
{ "apl", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x00dd, 0x00de, 0x00ae, 0x005e, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x005b, 0x005d, 0x00af, 0x00a8, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "37", "37", "3270cg-1a,iso10646-1"  },
 
179
{ "bracket", { 0x00a0, 0x00e2, 0x00e4, 0x00e0, 0x00e1, 0x00e3, 0x00e5, 0x00e7, 0x00f1, 0x00a2, 0x002e, 0x003c, 0x0028, 0x002b, 0x007c, 0x0026, 0x00e9, 0x00ea, 0x00eb, 0x00e8, 0x00ed, 0x00ee, 0x00ef, 0x00ec, 0x00df, 0x0021, 0x0024, 0x002a, 0x0029, 0x003b, 0x00ac, 0x002d, 0x002f, 0x00c2, 0x00c4, 0x00c0, 0x00c1, 0x00c3, 0x00c5, 0x00c7, 0x00d1, 0x00a6, 0x002c, 0x0025, 0x005f, 0x003e, 0x003f, 0x00f8, 0x00c9, 0x00ca, 0x00cb, 0x00c8, 0x00cd, 0x00ce, 0x00cf, 0x00cc, 0x0060, 0x003a, 0x0023, 0x0040, 0x0027, 0x003d, 0x0022, 0x00d8, 0x0061, 0x0062, 0x0063, 0x0064, 0x0065, 0x0066, 0x0067, 0x0068, 0x0069, 0x00ab, 0x00bb, 0x00f0, 0x00fd, 0x00fe, 0x00b1, 0x00b0, 0x006a, 0x006b, 0x006c, 0x006d, 0x006e, 0x006f, 0x0070, 0x0071, 0x0072, 0x00aa, 0x00ba, 0x00e6, 0x00b8, 0x00c6, 0x00a4, 0x00b5, 0x007e, 0x0073, 0x0074, 0x0075, 0x0076, 0x0077, 0x0078, 0x0079, 0x007a, 0x00a1, 0x00bf, 0x00d0, 0x005b, 0x00de, 0x00ae, 0x005e, 0x00a3, 0x00a5, 0x00b7, 0x00a9, 0x00a7, 0x00b6, 0x00bc, 0x00bd, 0x00be, 0x00dd, 0x00a8, 0x00af, 0x005d, 0x00b4, 0x00d7, 0x007b, 0x0041, 0x0042, 0x0043, 0x0044, 0x0045, 0x0046, 0x0047, 0x0048, 0x0049, 0x00ad, 0x00f4, 0x00f6, 0x00f2, 0x00f3, 0x00f5, 0x007d, 0x004a, 0x004b, 0x004c, 0x004d, 0x004e, 0x004f, 0x0050, 0x0051, 0x0052, 0x00b9, 0x00fb, 0x00fc, 0x00f9, 0x00fa, 0x00ff, 0x005c, 0x00f7, 0x0053, 0x0054, 0x0055, 0x0056, 0x0057, 0x0058, 0x0059, 0x005a, 0x00b2, 0x00d4, 0x00d6, 0x00d2, 0x00d3, 0x00d5, 0x0030, 0x0031, 0x0032, 0x0033, 0x0034, 0x0035, 0x0036, 0x0037, 0x0038, 0x0039, 0x00b3, 0x00db, 0x00dc, 0x00d9, 0x00da }, "37+", "37", "3270cg-1a,3270cg-1,iso10646-1,iso8859-1" },
 
180
{ NULL }
 
181
};
 
182
 
 
183
/* Code page aliases. */
 
184
 
 
185
typedef struct {
 
186
    char *alias;
 
187
    char *canon;
 
188
} cpalias_t;
 
189
 
 
190
cpalias_t cpaliases[] = {
 
191
    { "belgian",        "cp500" },
 
192
    { "belgian-euro",   "cp1148" },
 
193
    { "brazilian",      "cp275" },
 
194
#if defined(X3270_DBCS) /*[*/
 
195
    { "chinese-gb18030","cp1388" },
 
196
    { "cp1027",         "cp939" },      /* historical error */
 
197
    { "cp290",          "cp930" },      /* historical error */
 
198
#endif /*]*/
 
199
    { "cp37",           "cp037" },
 
200
#if defined(X3270_DBCS) /*[*/
 
201
    { "cp836",          "cp935" },      /* historical error */
 
202
#endif /*]*/
 
203
    { "finnish",        "cp278" },
 
204
    { "finnish-euro",   "cp1143" },
 
205
    { "french",         "cp297" },
 
206
    { "french-euro",    "cp1147" },
 
207
    { "german",         "cp273" },
 
208
    { "german-euro",    "cp1141" },
 
209
    { "greek",          "cp875" },
 
210
    { "hebrew",         "cp424" },
 
211
    { "icelandic",      "cp871" },
 
212
    { "icelandic-euro", "cp1149" },
 
213
    { "italian",        "cp280" },
 
214
    { "italian-euro",   "cp1144" },
 
215
#if defined(X3270_DBCS) /*[*/
 
216
    { "japanese-1027",  "cp939" },      /* historical error */
 
217
    { "japanese-290",   "cp930" },      /* historical error */
 
218
    { "japanese-kana",  "cp930" },
 
219
    { "japanese-latin", "cp939" },
 
220
#endif /*]*/
 
221
    { "norwegian",      "cp277" },
 
222
    { "norwegian-euro", "cp1142" },
 
223
    { "oldibm",         "bracket" },
 
224
    { "bracket437",     "bracket" },
 
225
    { "polish",         "cp870" },
 
226
    { "russian",        "cp880" },
 
227
#if defined(X3270_DBCS) /*[*/
 
228
    { "simplified-chinese","cp935" },
 
229
#endif /*]*/
 
230
    { "slovenian",      "cp870" },
 
231
    { "spanish",        "cp284" },
 
232
    { "spanish-euro",   "cp1145" },
 
233
    { "thai",           "cp1160" },
 
234
#if defined(X3270_DBCS) /*[*/
 
235
    { "traditional-chinese", "cp937" },
 
236
#endif /*]*/
 
237
    { "turkish",        "cp1026" },
 
238
    { "uk",             "cp285" },
 
239
    { "uk-euro",        "cp1146" },
 
240
    { DEFAULT_CSNAME,   "cp037" },
 
241
    { "us-euro",        "cp1140" },
 
242
    { "us-intl",        "cp037" },
 
243
    { NULL,             NULL }
 
244
};
 
245
 
 
246
static uni_t *cur_uni = NULL;
 
247
 
 
248
void
 
249
charset_list(void)
 
250
{
 
251
        int i;
 
252
        int j;
 
253
        char *sep = "";
 
254
 
 
255
        printf("SBCS host code pages (with aliases):\n");
 
256
        for (i = 0; uni[i].name != NULL; i++) {
 
257
                Boolean any = False;
 
258
                char *asep = " (";
 
259
 
 
260
                printf("%s%s", sep, uni[i].name);
 
261
                for (j = 0; cpaliases[j].alias != NULL; j++) {
 
262
 
 
263
                        if (!strcmp(cpaliases[j].canon, uni[i].name)) {
 
264
                                printf("%s%s", asep, cpaliases[j].alias);
 
265
                                asep = ", ";
 
266
                                any = True;
 
267
                        }
 
268
                }
 
269
                if (any)
 
270
                        printf(")");
 
271
                sep = ", ";
 
272
        }
 
273
        printf("\n");
 
274
 
 
275
#if defined(X3270_DBCS) /*[*/
 
276
        charset_list_dbcs();
 
277
#endif /*]*/
 
278
}
 
279
 
 
280
/*
 
281
 * Translate a single EBCDIC character in an arbitrary character set to
 
282
 * Unicode.  Note that CS_DBCS is never used -- use CS_BASE and pass an
 
283
 * EBCDIC character > 0xff.
 
284
 *
 
285
 * Returns 0 for no translation.
 
286
 */
 
287
ucs4_t
 
288
ebcdic_to_unicode(ebc_t c, unsigned char cs, unsigned flags)
 
289
{
 
290
        int iuc;
 
291
        ucs4_t uc;
 
292
 
 
293
#if 0   /* I'm not sure why this was put in, but it breaks display of DUP
 
294
           and FM.
 
295
           Hopefully I'll figure out why it was put in in the first place
 
296
           and I can put it back under the right conditions. */
 
297
        /* Control characters become blanks. */
 
298
        if (c <= 0x41 || c == 0xff)
 
299
                uc = 0;
 
300
#endif
 
301
 
 
302
        /*
 
303
         * We do not pay attention to BLANK_UNDEF -- we always return 0
 
304
         * for undefined characters.
 
305
         */
 
306
        flags &= ~EUO_BLANK_UNDEF;
 
307
 
 
308
        /* Dispatch on the character set. */
 
309
        if ((cs & CS_GE) || ((cs & CS_MASK) == CS_APL)) {
 
310
                iuc = apl_to_unicode(c, flags);
 
311
                if (iuc != -1)
 
312
                        uc = iuc;
 
313
                else
 
314
                        uc = 0;
 
315
        } else if (cs == CS_LINEDRAW) {
 
316
                iuc = linedraw_to_unicode(c /* XXX: flags */);
 
317
                if (iuc != -1)
 
318
                        uc = iuc;
 
319
                else
 
320
                        uc = 0;
 
321
        } else if (cs != CS_BASE)
 
322
                uc = 0;
 
323
        else
 
324
                uc = ebcdic_base_to_unicode(c, flags);
 
325
 
 
326
        return uc;
 
327
}
 
328
 
 
329
/*
 
330
 * Translate a single EBCDIC character in the base or DBCS character sets to
 
331
 *  Unicode.
 
332
 *
 
333
 * EBCDIC 'FM' and 'DUP' characters are treated specially.  If EUO_UPRIV
 
334
 *  is set, they are returned as U+f8fe and U+feff (private-use) respectively
 
335
 *  so they can be displayed with overscores in the special 3270 font;
 
336
 *  otherwise they are returned as '*' and ';'.
 
337
 * EBCDIC 'EO' and 'SUB' are special-cased to U+25cf and U+25a0, respectively.
 
338
 *
 
339
 * If EUO_BLANK_UNDEF is set, other undisplayable characters are returned as
 
340
 *  spaces; otherwise they are returned as 0.
 
341
 */
 
342
ucs4_t
 
343
ebcdic_base_to_unicode(ebc_t c, unsigned flags)
 
344
{
 
345
#if defined(X3270_DBCS) /*[*/
 
346
    if (c & 0xff00)
 
347
        return ebcdic_dbcs_to_unicode(c, flags);
 
348
#endif /*]*/
 
349
 
 
350
    if (c == 0x40)
 
351
        return 0x0020;
 
352
 
 
353
    if (c >= UT_OFFSET && c < 0xff) {
 
354
        ebc_t uc = cur_uni->code[c - UT_OFFSET];
 
355
 
 
356
        return uc? uc: ((flags & EUO_BLANK_UNDEF)? ' ': 0);
 
357
 
 
358
    } else switch (c) {
 
359
 
 
360
        case EBC_fm:
 
361
            return (flags & EUO_UPRIV)? UPRIV_fm: ';';
 
362
        case EBC_dup:
 
363
            return (flags & EUO_UPRIV)? UPRIV_dup: '*';
 
364
        case EBC_eo:
 
365
#if defined(C3270) /*[*/
 
366
            if (flags & EUO_ASCII_BOX)
 
367
                    return (flags & EUO_BLANK_UNDEF)? ' ': 0;
 
368
#endif /*]*/
 
369
            return (flags & EUO_UPRIV)? UPRIV_eo: 0x25cf; /* solid circle */
 
370
        case EBC_sub:
 
371
#if defined(C3270) /*[*/
 
372
            if (flags & EUO_ASCII_BOX)
 
373
                    return (flags & EUO_BLANK_UNDEF)? ' ': 0;
 
374
#endif /*]*/
 
375
            return (flags & EUO_UPRIV)? UPRIV_sub: 0x25a0; /* solid block */
 
376
        default:
 
377
            if (flags & EUO_BLANK_UNDEF)
 
378
                return ' ';
 
379
            else
 
380
                return 0;
 
381
    }
 
382
}
 
383
 
 
384
/*
 
385
 * Map a UCS-4 character to an EBCDIC character.
 
386
 * Returns 0 for failure, nonzero for success.
 
387
 */
 
388
ebc_t
 
389
unicode_to_ebcdic(ucs4_t u)
 
390
{
 
391
    int i;
 
392
#if defined(X3270_DBCS) /*[*/
 
393
    ebc_t d;
 
394
#endif /*]*/
 
395
 
 
396
    if (!u)
 
397
        return 0;
 
398
    if (u == 0x0020)
 
399
        return 0x40;
 
400
 
 
401
    for (i = 0; i < UT_SIZE; i++) {
 
402
        if (cur_uni->code[i] == u) {
 
403
            return UT_OFFSET + i;
 
404
        }
 
405
    }
 
406
#if defined(X3270_DBCS) /*[*/
 
407
    /* See if it's DBCS. */
 
408
    d = unicode_to_ebcdic_dbcs(u);
 
409
    if (d)
 
410
        return d;
 
411
#endif /*]*/
 
412
 
 
413
    return 0;
 
414
}
 
415
 
 
416
/*
 
417
 * Map a UCS-4 character to an EBCDIC character, possibly including APL (GE)
 
418
 * characters.
 
419
 * Returns 0 for failure, nonzero for success.
 
420
 */
 
421
ebc_t
 
422
unicode_to_ebcdic_ge(ucs4_t u, Boolean *ge)
 
423
{
 
424
    ebc_t e;
 
425
 
 
426
    *ge = False;
 
427
    e = unicode_to_ebcdic(u);
 
428
    if (e)
 
429
        return e;
 
430
 
 
431
    /* Handle GEs.  Yes, this is slow, but I'm lazy. */
 
432
    for (e = 0x70; e <= 0xfe; e++) {
 
433
        if ((ucs4_t)apl_to_unicode(e, EUO_NONE) == u) {
 
434
            *ge = True;
 
435
            return e;
 
436
        }
 
437
    }
 
438
 
 
439
    return 0;
 
440
}
 
441
 
 
442
/*
 
443
 * Set the SBCS EBCDIC-to-Unicode translation table.
 
444
 * Returns 0 for success, -1 for failure.
 
445
 */
 
446
int
 
447
set_uni(const char *csname, const char **host_codepage,
 
448
        const char **cgcsgid, const char **display_charsets)
 
449
{
 
450
        int i;
 
451
        const char *realname;
 
452
        int rc = -1;
 
453
        Boolean cannot_fail = False;
 
454
 
 
455
        /*
 
456
         * If the csname is NULL, this is a fallback to the default
 
457
         * and the iconv lookup cannot fail.
 
458
         */
 
459
        if (csname == NULL) {
 
460
                csname = DEFAULT_CSNAME;
 
461
                cannot_fail = True;
 
462
        }
 
463
        realname = csname;
 
464
 
 
465
        /* Search for an alias. */
 
466
        for (i = 0; cpaliases[i].alias != NULL; i++) {
 
467
                if (!strcasecmp(csname, cpaliases[i].alias)) {
 
468
                        realname = cpaliases[i].canon;
 
469
                        break;
 
470
                }
 
471
        }
 
472
 
 
473
        /* Search for a match. */
 
474
        for (i = 0; uni[i].name != NULL; i++) {
 
475
                if (!strcasecmp(realname, uni[i].name)) {
 
476
                        cur_uni = &uni[i];
 
477
                        *host_codepage = uni[i].host_codepage;
 
478
                        *cgcsgid = uni[i].cgcsgid;
 
479
                        *display_charsets = uni[i].display_charset;
 
480
                        rc = 0;
 
481
                        break;
 
482
                }
 
483
        }
 
484
 
 
485
        if (cannot_fail && rc == -1)
 
486
                Error("Cannot find default charset definition");
 
487
 
 
488
#if defined(USE_ICONV) /*[*/
 
489
        /*
 
490
         * wchar_t's are not Unicode, so getting to/from Unicode is only half
 
491
         * the battle.  We need to use iconv() to get between Unicode to the
 
492
         * local multi-byte representation.  We'll explicitly use UTF-8, which
 
493
         * appears to be the most broadly-supported translation.
 
494
         */
 
495
        if (rc == 0) {
 
496
                if (!is_utf8) {
 
497
                        /*
 
498
                         * If iconv doesn't support the locale's codeset, then
 
499
                         * this box is hosed.
 
500
                         */
 
501
                        i_u2mb = iconv_open(locale_codeset, "UTF-8");
 
502
                        if (i_u2mb == (iconv_t)(-1))
 
503
                                rc = -1;
 
504
                        else {
 
505
                                i_mb2u = iconv_open("UTF-8", locale_codeset);
 
506
                                if (i_mb2u == (iconv_t)(-1)) {
 
507
                                        iconv_close(i_u2mb);
 
508
                                        rc = -1;
 
509
                                }
 
510
                        }
 
511
                }
 
512
 
 
513
                if (rc == -1 && cannot_fail) {
 
514
                        /* Try again with plain-old ASCII. */
 
515
#if defined(PR3287) /*[*/
 
516
                        Warning("Cannot find iconv translation from locale "
 
517
                                "codeset to UTF-8, using ASCII");
 
518
#else /*][*/
 
519
                        xs_warning("Cannot find iconv translation from locale "
 
520
                                "codeset '%s' to UTF-8, using ASCII",
 
521
                                locale_codeset);
 
522
#endif /*]*/
 
523
                        i_u2mb = iconv_open("ASCII", "UTF-8");
 
524
                        if (i_u2mb == (iconv_t)-1)
 
525
                                Error("No iconv UTF-8 to ASCII translation");
 
526
                        i_mb2u = iconv_open("UTF-8", "ASCII");
 
527
                        if (i_mb2u == (iconv_t)-1)
 
528
                                Error("No iconv ASCII to UTF-8 translation");
 
529
                        rc = 0;
 
530
                }
 
531
        }
 
532
#endif /*]*/
 
533
 
 
534
        return rc;
 
535
}
 
536
 
 
537
/*
 
538
 * Translate an x3270 font line-drawing character (the first two rows of a
 
539
 * standard X11 fixed-width font) to Unicode.
 
540
 *
 
541
 * Returns -1 if there is no translation.
 
542
 */
 
543
int
 
544
linedraw_to_unicode(ebc_t c)
 
545
{
 
546
        static ebc_t ld2uc[32] = {
 
547
    /* 00 */    0x2588, 0x25c6, 0x2592, 0x0000, 0x0000, 0x0000, 0x0000, 0x00b0,
 
548
    /* 08 */    0x00b1, 0x0000, 0x0000, 0x2518, 0x2510, 0x250c, 0x2514, 0x253c,
 
549
    /* 10 */    0x002d, 0x002d, 0x2500, 0x002d, 0x005f, 0x251c, 0x2524, 0x2534,
 
550
    /* 18 */    0x252c, 0x2502, 0x2264, 0x2265, 0x03c0, 0x2260, 0x00a3, 0x2022
 
551
        };
 
552
 
 
553
        if (c < 32 && ld2uc[c] != 0x0000)
 
554
                return ld2uc[c];
 
555
        else
 
556
                return -1;
 
557
}
 
558
 
 
559
int
 
560
apl_to_unicode(ebc_t c, unsigned flags)
 
561
{
 
562
        static ebc_t apl2uc[256] = {
 
563
    /* 00 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
564
    /* 08 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
565
    /* 10 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
566
    /* 18 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
567
    /* 20 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
568
    /* 28 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
569
    /* 30 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
570
    /* 38 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
571
    /* 40 */    0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
572
    /* 48 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
573
    /* 50 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
574
    /* 58 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
575
    /* 60 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
576
    /* 68 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
577
    /* 70 */    0x25c6, 0x22c0, 0x00a8, 0x223b, 0x2378, 0x2377, 0x22a2, 0x22a3,
 
578
    /* 78 */    0x2228, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
579
    /* 80 */    0x007e, 0x0000, 0x0000, 0x23b8, 0x23b9, 0x2502, 0x0000, 0x0000,
 
580
    /* 88 */    0x0000, 0x0000, 0x2191, 0x2193, 0x2264, 0x2308, 0x230a, 0x2192,
 
581
    /* 90 */    0x2395, 0x258c, 0x2590, 0x2580, 0x2584, 0x25a0, 0x0000, 0x0000,
 
582
    /* 98 */    0x0000, 0x0000, 0x2283, 0x2282, 0x00a4, 0x25cb, 0x00b1, 0x2190,
 
583
    /* a0 */    0x00af, 0x00b0, 0x2500, 0x2022, 0x0000, 0x0000, 0x0000, 0x0000,
 
584
    /* a8 */    0x0000, 0x0000, 0x22c2, 0x22c3, 0x22a5, 0x005b, 0x2265, 0x2218,
 
585
    /* b0 */    0x03b1, 0x03b5, 0x03b9, 0x03c1, 0x03c9, 0x0000, 0x00d7, 0x005c,
 
586
    /* b8 */    0x00f7, 0x0000, 0x2207, 0x2206, 0x22a4, 0x005d, 0x2260, 0x2502,
 
587
    /* c0 */    0x007b, 0x207c, 0x002b, 0x220e, 0x2514, 0x250c, 0x251c, 0x2534,
 
588
    /* c8 */    0x00a7, 0x0000, 0x2372, 0x2371, 0x2337, 0x233d, 0x2342, 0x2349,
 
589
    /* d0 */    0x007d, 0x207e, 0x002d, 0x253c, 0x2518, 0x2510, 0x2524, 0x252c,
 
590
    /* d8 */    0x00b6, 0x0000, 0x2336, 0x0021, 0x2352, 0x234b, 0x235e, 0x235d,
 
591
    /* e0 */    0x2261, 0x2081, 0x0282, 0x0283, 0x2364, 0x2365, 0x236a, 0x20ac,
 
592
    /* e8 */    0x0000, 0x0000, 0x233f, 0x2240, 0x2235, 0x2296, 0x2339, 0x2355,
 
593
    /* f0 */    0x2070, 0x00b9, 0x00b2, 0x00b3, 0x2074, 0x2075, 0x2076, 0x2077,
 
594
    /* f8 */    0x2078, 0x2079, 0x0000, 0x236b, 0x2359, 0x235f, 0x234e, 0x0000
 
595
        };
 
596
#if defined(C3270) /*[*/
 
597
        static ebc_t apla2uc[256] = {
 
598
    /* 00 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
599
    /* 08 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
600
    /* 10 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
601
    /* 18 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
602
    /* 20 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
603
    /* 28 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
604
    /* 30 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
605
    /* 38 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
606
    /* 40 */    0x0020, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
607
    /* 48 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
608
    /* 50 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
609
    /* 58 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
610
    /* 60 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
611
    /* 68 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
612
    /* 70 */    0x0000, 0x0000, 0x00a8, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
613
    /* 78 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
614
    /* 80 */    0x007e, 0x0000, 0x0000, 0x0000, 0x0000, 0x007c, 0x0000, 0x0000,
 
615
    /* 88 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
616
    /* 90 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
617
    /* 98 */    0x0000, 0x0000, 0x0000, 0x0000, 0x00a4, 0x0000, 0x00b1, 0x0000,
 
618
    /* a0 */    0x00af, 0x00b0, 0x002d, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
619
    /* a8 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x005b, 0x0000, 0x0000,
 
620
    /* b0 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x00d7, 0x005c,
 
621
    /* b8 */    0x00f7, 0x0000, 0x0000, 0x0000, 0x0000, 0x005d, 0x0000, 0x007c,
 
622
    /* c0 */    0x007b, 0x0000, 0x002b, 0x0000, 0x002b, 0x002b, 0x002b, 0x002b,
 
623
    /* c8 */    0x00a7, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
624
    /* d0 */    0x007d, 0x0000, 0x002d, 0x002b, 0x002b, 0x002b, 0x002b, 0x002b,
 
625
    /* d8 */    0x00b6, 0x0000, 0x0000, 0x0021, 0x0000, 0x0000, 0x0000, 0x0000,
 
626
    /* e0 */    0x0000, 0x0000, 0x0282, 0x0283, 0x0000, 0x0000, 0x0000, 0x0000,
 
627
    /* e8 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000,
 
628
    /* f0 */    0x0000, 0x00b9, 0x00b2, 0x00b3, 0x0000, 0x0000, 0x0000, 0x0000,
 
629
    /* f8 */    0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000
 
630
        };
 
631
#endif /*]*/
 
632
 
 
633
#if defined(C3270) /*[*/
 
634
        if (flags & EUO_ASCII_BOX) {
 
635
                if (c < 256 && apla2uc[c] != 0x0000) {
 
636
#if defined(_WIN32) /*[*/
 
637
                        /* Windows DBCS fonts make U+0080..U+00ff wide, too. */
 
638
                        if (apla2uc[c] > 0x7f)
 
639
                                return -1;
 
640
#endif /*]*/
 
641
                        return apla2uc[c];
 
642
                } else
 
643
                        return -1;
 
644
        }
 
645
#endif /*]*/
 
646
 
 
647
        if (c < 256 && apl2uc[c] != 0x0000)
 
648
                return apl2uc[c];
 
649
        else
 
650
                return -1;
 
651
}
 
652
 
 
653
/*
 
654
 * Translate an EBCDIC character to the current locale's multi-byte
 
655
 * representation.
 
656
 *
 
657
 * Returns the number of bytes in the multi-byte representation, including
 
658
 * the terminating NULL.  mb[] should be big enough to include the NULL
 
659
 * in the result.
 
660
 *
 
661
 * Also returns in 'ucp' the UCS-4 Unicode value of the EBCDIC character.
 
662
 *
 
663
 * Note that 'ebc' is an ebc_t (uint16_t), not an unsigned char.  This is
 
664
 * so that DBCS values can be passed in as 16 bits (with the first byte
 
665
 * in the high-order bits).  There is no ambiguity because all valid EBCDIC
 
666
 * DBCS characters have a nonzero first byte.
 
667
 *
 
668
 * Returns 0 if EUO_BLANK_UNDEF is clear and there is no printable EBCDIC
 
669
 * translation for 'ebc'.
 
670
 *
 
671
 * Returns '?' in mb[] if there is no local multi-byte representation of
 
672
 * the EBCDIC character.
 
673
 */
 
674
int
 
675
ebcdic_to_multibyte_x(ebc_t ebc, unsigned char cs, char mb[],
 
676
        int mb_len, unsigned flags, ucs4_t *ucp)
 
677
{
 
678
        ucs4_t uc;
 
679
 
 
680
#if defined(_WIN32) /*[*/
 
681
        int nc;
 
682
        BOOL udc;
 
683
        wchar_t wuc;
 
684
#elif defined(UNICODE_WCHAR) /*][*/
 
685
        int nc;
 
686
        wchar_t wuc;
 
687
#else /*][*/
 
688
        char u8b[7];
 
689
        size_t nu8;
 
690
        ici_t inbuf;
 
691
        char *outbuf;
 
692
        size_t inbytesleft, outbytesleft;
 
693
        size_t nc;
 
694
#endif /*]*/
 
695
 
 
696
        /* Translate from EBCDIC to Unicode. */
 
697
        uc = ebcdic_to_unicode(ebc, cs, flags);
 
698
        if (ucp != NULL)
 
699
                *ucp = uc;
 
700
        if (uc == 0) {
 
701
                if (flags & EUO_BLANK_UNDEF) {
 
702
                        mb[0] = ' ';
 
703
                        mb[1] = '\0';
 
704
                        return 2;
 
705
                } else {
 
706
                        return 0;
 
707
                }
 
708
        }
 
709
 
 
710
        /* Translate from Unicode to local multibyte. */
 
711
 
 
712
#if defined(_WIN32) /*[*/
 
713
        /*
 
714
         * wchar_t's are Unicode.
 
715
         */
 
716
        wuc = uc;
 
717
        nc = WideCharToMultiByte(LOCAL_CODEPAGE, 0, &wuc, 1, mb, mb_len,
 
718
                "?", &udc);
 
719
        if (nc != 0) {
 
720
                mb[nc++] = '\0';
 
721
                return nc;
 
722
        } else {
 
723
                mb[0] = '?';
 
724
                mb[1] = '\0';
 
725
                return 2;
 
726
        }
 
727
 
 
728
#elif defined(UNICODE_WCHAR) /*][*/
 
729
        /*
 
730
         * wchar_t's are Unicode.
 
731
         * If 'is_utf8' is set, use unicode_to_utf8().  This allows us to set
 
732
         *  'is_utf8' directly, ignoring the locale, for Tcl.
 
733
         * Otherwise, use wctomb().
 
734
         */
 
735
        if (is_utf8) {
 
736
                nc = unicode_to_utf8(uc, mb);
 
737
                if (nc < 0)
 
738
                        return 0;
 
739
                mb[nc++] = '\0';
 
740
                return nc;
 
741
        }
 
742
 
 
743
        wuc = uc;
 
744
        nc = wctomb(mb, uc);
 
745
        if (nc > 0) {
 
746
                /* Return to the initial shift state and null-terminate. */
 
747
                nc += wctomb(mb + nc, 0);
 
748
                return nc;
 
749
        } else {
 
750
                mb[0] = '?';
 
751
                mb[1] = '\0';
 
752
                return 2;
 
753
        }
 
754
#else /*][*/
 
755
        /*
 
756
         * Use iconv.
 
757
         */
 
758
 
 
759
        /* Translate the wchar_t we got from UCS-4 to UTF-8. */
 
760
        nu8 = unicode_to_utf8(uc, u8b);
 
761
        if (nu8 < 0)
 
762
                return 0;
 
763
 
 
764
        /* Local multi-byte might be UTF-8, in which case, we're done. */
 
765
        if (is_utf8) {
 
766
            memcpy(mb, u8b, nu8);
 
767
            mb[nu8++] = '\0';
 
768
            return nu8;
 
769
        }
 
770
 
 
771
        /* Let iconv translate from UTF-8 to local multi-byte. */
 
772
        inbuf = u8b;
 
773
        inbytesleft = nu8;
 
774
        outbuf = mb;
 
775
        outbytesleft = mb_len;
 
776
        nc = iconv(i_u2mb, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
 
777
        if (nc < 0 || inbytesleft == nu8) {
 
778
                mb[0] = '?';
 
779
                mb[1] = '\0';
 
780
                return 2;
 
781
        }
 
782
 
 
783
        /* Return to the initial shift state. */
 
784
        nc = iconv(i_u2mb, NULL, NULL, &outbuf, &outbytesleft);
 
785
        if (nc < 0) {
 
786
                mb[0] = '?';
 
787
                mb[1] = '\0';
 
788
                return 0;
 
789
        }
 
790
 
 
791
        /* Null-terminate the return the length. */
 
792
        mb[mb_len - outbytesleft--] = '\0';
 
793
        return mb_len - outbytesleft;
 
794
 
 
795
#endif /*]*/
 
796
}
 
797
 
 
798
/* Commonest version of ebcdic_to_multibyte_x:
 
799
 *  cs is CS_BASE
 
800
 *  EUO_BLANK_UNDEF is set
 
801
 *  ucp is ignored
 
802
 */
 
803
int
 
804
ebcdic_to_multibyte(ebc_t ebc, char mb[], int mb_len)
 
805
{
 
806
        return ebcdic_to_multibyte_x(ebc, CS_BASE, mb, mb_len, EUO_BLANK_UNDEF,
 
807
                NULL);
 
808
}
 
809
 
 
810
/*
 
811
 * Convert an EBCDIC string to a multibyte string.
 
812
 * Makes lots of assumptions: standard character set, EUO_BLANK_UNDEF.
 
813
 * Returns the length of the multibyte string.
 
814
 */
 
815
int
 
816
ebcdic_to_multibyte_string(unsigned char *ebc, size_t ebc_len, char mb[],
 
817
        size_t mb_len)
 
818
{
 
819
        int nmb = 0;
 
820
 
 
821
        while (ebc_len && mb_len) {
 
822
                int xlen;
 
823
 
 
824
                xlen = ebcdic_to_multibyte(*ebc, mb, mb_len);
 
825
                if (xlen) {
 
826
                        mb += xlen - 1;
 
827
                        mb_len -= (xlen - 1);
 
828
                        nmb += xlen - 1;
 
829
                }
 
830
                ebc++;
 
831
                ebc_len--;
 
832
        }
 
833
        return nmb;
 
834
}
 
835
 
 
836
/*
 
837
 * Return the maximum buffer length needed to translate 'len' EBCDIC characters
 
838
 * in the current locale.
 
839
 */
 
840
int
 
841
mb_max_len(int len)
 
842
{
 
843
#if defined(_WIN32) /*[*/
 
844
    /*
 
845
     * On Windows, it's 1:1 (we don't do DBCS, and we don't support locales
 
846
     * like UTF-8).
 
847
     */
 
848
    return len + 1;
 
849
#elif defined(UNICODE_WCHAR) /*][*/
 
850
    /* Allocate enough space for shift-state transitions. */
 
851
    return (MB_CUR_MAX * (len * 2)) + 1;
 
852
#else /*]*/
 
853
    if (is_utf8)
 
854
        return (len * 6) + 1;
 
855
    else
 
856
        /*
 
857
         * We don't actually know.  Guess that MB_CUR_MAX is 16, and compute
 
858
         * as for UNICODE_WCHAR.
 
859
         */
 
860
        return (16 * (len * 2)) + 1;
 
861
#endif /*]*/
 
862
}
 
863
 
 
864
/*
 
865
 * Translate a multi-byte character in the current locale to UCS-4.
 
866
 *
 
867
 * Returns a UCS-4 character or 0, indicating an error in translation.
 
868
 * Also returns the number of characters consumed.
 
869
 */
 
870
ucs4_t
 
871
multibyte_to_unicode(const char *mb, size_t mb_len, int *consumedp,
 
872
        enum me_fail *errorp)
 
873
{
 
874
    size_t nw;
 
875
    ucs4_t ucs4;
 
876
#if defined(_WIN32) /*[*/
 
877
    wchar_t wc[3];
 
878
    int i;
 
879
 
 
880
    /* Use MultiByteToWideChar() to get from the ANSI codepage to UTF-16. */
 
881
    for (i = 1; i <= mb_len; i++) {
 
882
        nw = MultiByteToWideChar(LOCAL_CODEPAGE, MB_ERR_INVALID_CHARS,
 
883
                mb, i, wc, 3);
 
884
        if (nw != 0)
 
885
            break;
 
886
    }
 
887
    if (i > mb_len) {
 
888
        *errorp = ME_INVALID;
 
889
        return 0;
 
890
    }
 
891
    *consumedp = i;
 
892
    ucs4 = wc[0];
 
893
#elif defined(UNICODE_WCHAR) /*][*/
 
894
    wchar_t wc[3];
 
895
    /* wchar_t's are Unicode. */
 
896
 
 
897
    if (is_utf8) {
 
898
        int nc;
 
899
 
 
900
        /*
 
901
         * Use utf8_to_unicode() instead of mbtowc(), so we can set is_utf8
 
902
         * directly and ignore the locale for Tcl.
 
903
         */
 
904
        nc = utf8_to_unicode(mb, mb_len, &ucs4);
 
905
        if (nc > 0) {
 
906
            *errorp = ME_NONE;
 
907
            *consumedp = nc;
 
908
            return ucs4;
 
909
        } else if (nc == 0) {
 
910
            *errorp = ME_SHORT;
 
911
            return 0;
 
912
        } else {
 
913
            *errorp = ME_INVALID;
 
914
            return 0;
 
915
        }
 
916
    }
 
917
 
 
918
    /* mbtowc() will translate to Unicode. */
 
919
    nw = mbtowc(wc, mb, mb_len);
 
920
    if (nw == (size_t)-1) {
 
921
        if (errno == EILSEQ)
 
922
            *errorp = ME_INVALID;
 
923
        else
 
924
            *errorp = ME_SHORT;
 
925
        nw = mbtowc(NULL, NULL, 0);
 
926
        return 0;
 
927
    }
 
928
 
 
929
    /*
 
930
     * Reset the shift state.
 
931
     * XXX: Doing this will ruin the shift state if this function is called
 
932
     * repeatedly to process a string.  There should probably be a parameter
 
933
     * passed in to control whether or not to reset the shift state, or
 
934
     * perhaps there should be a function to translate a string.
 
935
     */
 
936
    *consumedp = nw;
 
937
    nw = mbtowc(NULL, NULL, 0);
 
938
 
 
939
    ucs4 = wc[0];
 
940
#else /*][*/
 
941
    /* wchar_t's have unknown encoding. */
 
942
    if (!is_utf8) {
 
943
        ici_t inbuf;
 
944
        char *outbuf;
 
945
        size_t inbytesleft, outbytesleft;
 
946
        char utf8buf[16];
 
947
        size_t ibl;
 
948
 
 
949
        /* Translate from local MB to UTF-8 using iconv(). */
 
950
        for (ibl = 1; ibl <= mb_len; ibl++) {
 
951
            inbuf = (ici_t)mb;
 
952
            outbuf = utf8buf;
 
953
            inbytesleft = ibl;
 
954
            outbytesleft = sizeof(utf8buf);
 
955
            nw = iconv(i_mb2u, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
 
956
            if (nw < 0) {
 
957
                if (errno == EILSEQ) {
 
958
                    *errorp = ME_INVALID;
 
959
                    (void) iconv(i_mb2u, NULL, NULL, NULL, NULL);
 
960
                    return 0;
 
961
                } else {
 
962
                    if (ibl == mb_len) {
 
963
                        *errorp = ME_SHORT;
 
964
                        (void) iconv(i_mb2u, NULL, NULL, NULL, NULL);
 
965
                        return 0;
 
966
                    }
 
967
                }
 
968
            } else
 
969
                break;
 
970
        }
 
971
        *consumedp = ibl - inbytesleft;
 
972
 
 
973
        /* Translate from UTF-8 to UCS-4. */
 
974
        (void) utf8_to_unicode(utf8buf, sizeof(utf8buf) - outbytesleft, &ucs4);
 
975
    } else {
 
976
        /* Translate from UTF-8 to UCS-4. */
 
977
        nw = utf8_to_unicode(mb, mb_len, &ucs4);
 
978
        if (nw < 0) {
 
979
            *errorp = ME_INVALID;
 
980
            return 0;
 
981
        }
 
982
        if (nw == 0) {
 
983
            *errorp = ME_SHORT;
 
984
            return 0;
 
985
        }
 
986
        *consumedp = nw;
 
987
    }
 
988
#endif /*]*/
 
989
 
 
990
    /* Translate from UCS4 to EBCDIC. */
 
991
    return ucs4;
 
992
}
 
993
 
 
994
/*
 
995
 * Convert a multi-byte string to a UCS-4 string.
 
996
 * Does not NULL-terminate the result.
 
997
 * Returns the number of UCS-4 characters stored.
 
998
 */
 
999
int
 
1000
multibyte_to_unicode_string(char *mb, size_t mb_len, ucs4_t *ucs4,
 
1001
        size_t u_len)
 
1002
{
 
1003
    int consumed;
 
1004
    enum me_fail error;
 
1005
    int nr = 0;
 
1006
 
 
1007
    error = ME_NONE;
 
1008
 
 
1009
    while (u_len && mb_len &&
 
1010
            (*ucs4++ = multibyte_to_unicode(mb, mb_len, &consumed,
 
1011
                                            &error)) != 0) {
 
1012
        u_len--;
 
1013
        mb += consumed;
 
1014
        mb_len -= consumed;
 
1015
        nr++;
 
1016
    }
 
1017
 
 
1018
    if (error != ME_NONE)
 
1019
        return -1;
 
1020
    else
 
1021
        return nr;
 
1022
}
 
1023
 
 
1024
/*
 
1025
 * Translate a multi-byte character in the current locale to an EBCDIC
 
1026
 * character.
 
1027
 *
 
1028
 * Returns an 8-bit (SBCS) or 16-bit (DBCS) EBCDIC character, or 0, indicating
 
1029
 * an error in translation.  Also returns the number of characters consumed.
 
1030
 */
 
1031
ebc_t
 
1032
multibyte_to_ebcdic(const char *mb, size_t mb_len, int *consumedp,
 
1033
        enum me_fail *errorp)
 
1034
{
 
1035
    ucs4_t ucs4;
 
1036
 
 
1037
    ucs4 = multibyte_to_unicode(mb, mb_len, consumedp, errorp);
 
1038
    if (ucs4 == 0)
 
1039
        return 0;
 
1040
    return unicode_to_ebcdic(ucs4);
 
1041
}
 
1042
 
 
1043
/*
 
1044
 * Convert a local multi-byte string to an EBCDIC string.
 
1045
 * Returns the length of the resulting EBCDIC string, or -1 if there is a
 
1046
 * conversion error.
 
1047
 */
 
1048
int
 
1049
multibyte_to_ebcdic_string(char *mb, size_t mb_len, unsigned char *ebc,
 
1050
        size_t ebc_len, enum me_fail *errorp)
 
1051
{
 
1052
    int ne = 0;
 
1053
    Boolean in_dbcs = False;
 
1054
 
 
1055
    while (mb_len > 0 && ebc_len > 0) {
 
1056
        ebc_t e;
 
1057
        int consumed;
 
1058
 
 
1059
        e = multibyte_to_ebcdic(mb, mb_len, &consumed, errorp);
 
1060
        if (e == 0)
 
1061
            return -1;
 
1062
        if (e & 0xff00) {
 
1063
            /* DBCS. */
 
1064
            if (!in_dbcs) {
 
1065
                /* Make sure there's room for SO, b1, b2, SI. */
 
1066
                if (ebc_len < 4)
 
1067
                    return ne;
 
1068
                *ebc++ = EBC_so;
 
1069
                ebc_len++;
 
1070
                ne++;
 
1071
                in_dbcs = True;
 
1072
            }
 
1073
            /* Make sure there's room for b1, b2, SI. */
 
1074
            if (ebc_len < 3) {
 
1075
                *ebc++ = EBC_si;
 
1076
                ne++;
 
1077
                return ne;
 
1078
            }
 
1079
            *ebc++ = (e >> 8) & 0xff;
 
1080
            *ebc++ = e & 0xff;
 
1081
            ebc_len -= 2;
 
1082
            ne += 2;
 
1083
        } else {
 
1084
            /* SBCS. */
 
1085
            if (in_dbcs) {
 
1086
                *ebc++ = EBC_si;
 
1087
                ne++;
 
1088
                if (!--ebc_len)
 
1089
                    return ne;
 
1090
                in_dbcs = False;
 
1091
            }
 
1092
            *ebc++ = e & 0xff;
 
1093
            ebc_len--;
 
1094
            ne++;
 
1095
        }
 
1096
        mb += consumed;
 
1097
        mb_len -= consumed;
 
1098
    }
 
1099
 
 
1100
    /*
 
1101
     * Terminate the DBCS string, if we end inside it.
 
1102
     * We're guaranteed to have space for the SI; we checked before adding
 
1103
     * the last DBCS character.
 
1104
     */
 
1105
    if (in_dbcs) {
 
1106
        *ebc++ = EBC_si;
 
1107
        ne++;
 
1108
    }
 
1109
 
 
1110
    return ne;
 
1111
}
 
1112
 
 
1113
/*
 
1114
 * Translate a UCS-4 character to a local multi-byte string.
 
1115
 */
 
1116
int
 
1117
unicode_to_multibyte(ucs4_t ucs4, char *mb, size_t mb_len)
 
1118
{
 
1119
#if defined(_WIN32) /*[*/
 
1120
    wchar_t wuc = ucs4;
 
1121
    BOOL udc;
 
1122
    int nc;
 
1123
 
 
1124
    nc = WideCharToMultiByte(LOCAL_CODEPAGE, 0, &wuc, 1, mb, mb_len,
 
1125
            "?", &udc);
 
1126
    if (nc > 0)
 
1127
        mb[nc++] = '\0';
 
1128
    return nc;
 
1129
#elif defined(UNICODE_WCHAR) /*][*/
 
1130
    int nc;
 
1131
 
 
1132
    if (is_utf8) {
 
1133
        nc = unicode_to_utf8(ucs4, mb);
 
1134
        if (nc < 0)
 
1135
            return 0;
 
1136
        mb[nc++] = '\0';
 
1137
        return nc;
 
1138
    }
 
1139
 
 
1140
    nc = wctomb(mb, ucs4);
 
1141
    if (nc > 0) {
 
1142
        /* Return to the initial shift state and null-terminate. */
 
1143
        nc += wctomb(mb + nc, 0);
 
1144
        return nc;
 
1145
    } else {
 
1146
        mb[0] = '?';
 
1147
        mb[1] = '\0';
 
1148
        return 2;
 
1149
    }
 
1150
#else /*][*/
 
1151
    int nu8;
 
1152
    char u8b[16];
 
1153
    ici_t inbuf;
 
1154
    char *outbuf;
 
1155
    size_t inbytesleft, outbytesleft;
 
1156
    size_t nc;
 
1157
 
 
1158
    /* Use iconv. */
 
1159
 
 
1160
    /* Translate the wchar_t we got from UCS-4 to UTF-8. */
 
1161
    nu8 = unicode_to_utf8(ucs4, u8b);
 
1162
    if (nu8 < 0)
 
1163
        return 0;
 
1164
 
 
1165
    /* Local multi-byte might be UTF-8, in which case, we're done. */
 
1166
    if (is_utf8) {
 
1167
        memcpy(mb, u8b, nu8);
 
1168
        mb[nu8++] = '\0';
 
1169
        return nu8;
 
1170
    }
 
1171
 
 
1172
    /* Let iconv translate from UTF-8 to local multi-byte. */
 
1173
    inbuf = u8b;
 
1174
    inbytesleft = nu8;
 
1175
    outbuf = mb;
 
1176
    outbytesleft = mb_len;
 
1177
    nc = iconv(i_u2mb, &inbuf, &inbytesleft, &outbuf, &outbytesleft);
 
1178
    if (nc == (size_t)-1) {
 
1179
        mb[0] = '?';
 
1180
        mb[1] = '\0';
 
1181
        return 2;
 
1182
    }
 
1183
 
 
1184
    /* Return to the initial shift state. */
 
1185
    nc = iconv(i_u2mb, NULL, NULL, &outbuf, &outbytesleft);
 
1186
    if (nc == (size_t)-1) {
 
1187
        mb[0] = '?';
 
1188
        mb[1] = '\0';
 
1189
        return 0;
 
1190
    }
 
1191
 
 
1192
    /* Null-terminate the return the length. */
 
1193
    mb[mb_len - outbytesleft--] = '\0';
 
1194
    return mb_len - outbytesleft;
 
1195
#endif /*]*/
 
1196
}