blob: 1492481f5426f46ad68f40ece2f54bdfa7f977d5 [file] [log] [blame]
Lev Walkinf15320b2004-06-03 03:38:44 +00001/*-
Lev Walkin4902f052006-10-16 12:18:10 +00002 * Copyright (c) 2003, 2006 Lev Walkin <vlm@lionet.info>. All rights reserved.
Lev Walkinf15320b2004-06-03 03:38:44 +00003 * Redistribution and modifications are permitted subject to BSD license.
4 */
Lev Walkina9cc46e2004-09-22 16:06:28 +00005#include <asn_internal.h>
Lev Walkinf15320b2004-06-03 03:38:44 +00006#include <TeletexString.h>
7
8/*
9 * TeletexString basic type description.
10 */
Wim Lewis18c2ec92014-07-29 11:30:10 -070011static const ber_tlv_tag_t asn_DEF_TeletexString_tags[] = {
Lev Walkin188ed2c2004-09-13 08:31:01 +000012 (ASN_TAG_CLASS_UNIVERSAL | (20 << 2)), /* [UNIVERSAL 20] IMPLICIT ...*/
13 (ASN_TAG_CLASS_UNIVERSAL | (4 << 2)), /* ... OCTET STRING */
Lev Walkinf15320b2004-06-03 03:38:44 +000014};
Lev Walkin5e033762004-09-29 13:26:15 +000015asn_TYPE_descriptor_t asn_DEF_TeletexString = {
Lev Walkinf15320b2004-06-03 03:38:44 +000016 "TeletexString",
Lev Walkindc06f6b2004-10-20 15:50:55 +000017 "TeletexString",
Lev Walkina9cc46e2004-09-22 16:06:28 +000018 OCTET_STRING_free,
19 OCTET_STRING_print, /* non-ascii string */
Lev Walkinf15320b2004-06-03 03:38:44 +000020 asn_generic_unknown_constraint,
21 OCTET_STRING_decode_ber, /* Implemented in terms of OCTET STRING */
Lev Walkindc06f6b2004-10-20 15:50:55 +000022 OCTET_STRING_encode_der,
23 OCTET_STRING_decode_xer_hex,
24 OCTET_STRING_encode_xer,
Lev Walkin80334ed2017-07-06 07:28:21 -070025#ifdef ASN_DISABLE_PER_SUPPORT
26 0,
27 0,
28#else
Lev Walkin725883b2006-10-09 12:07:58 +000029 OCTET_STRING_decode_uper,
30 OCTET_STRING_encode_uper,
Lev Walkin80334ed2017-07-06 07:28:21 -070031#endif /* ASN_DISABLE_PER_SUPPORT */
Lev Walkinf15320b2004-06-03 03:38:44 +000032 0, /* Use generic outmost tag fetcher */
Lev Walkin5e033762004-09-29 13:26:15 +000033 asn_DEF_TeletexString_tags,
34 sizeof(asn_DEF_TeletexString_tags)
35 / sizeof(asn_DEF_TeletexString_tags[0]) - 1,
36 asn_DEF_TeletexString_tags,
37 sizeof(asn_DEF_TeletexString_tags)
38 / sizeof(asn_DEF_TeletexString_tags[0]),
Lev Walkin59b176e2005-11-26 11:25:14 +000039 0, /* No PER visible constraints */
Lev Walkin449f8322004-08-20 13:23:42 +000040 0, 0, /* No members */
Lev Walkind9bd7752004-06-05 08:17:50 +000041 0 /* No specifics */
Lev Walkinf15320b2004-06-03 03:38:44 +000042};
43
Lev Walkin4902f052006-10-16 12:18:10 +000044/*
45 * Here is a formal attempt at creating a mapping from TeletexString
46 * (T61String) of the latest ASN.1 standard (X.680:2002) into the Unicode
47 * character set. -- Lev Walkin <vlm@lionet.info>
48 *
49 * The first thing to keep in mind is that TeletexString (T61String)
50 * is defined in ASN.1, and is not really a T.61 string.
51 * The T.61 standard is withdrawn by ITU-T and is no longer an authoritative
52 * reference. See http://www.itu.int/rec/T-REC-T.61
53 *
54 * The X.680 specifies TeletexString (T61String) as a combination of the
55 * character sets specified by the registration numbers listed in
56 * ISO International Register of Coded Character Sets to be used with
57 * Escape Sequences (ISO-2375):
58 * 6, 87, 102, 103, 106, 107, 126, 144, 150, 153, 156, 164, 165, 168,
59 * plus SPACE and DELETE characters.
60 * In addition to that, the X.680 Table 6 NOTE 2 allows using register entries
61 * 6 and 156 instead of 102 and 103.
62 *
63 * The ISO Register itself is available at http://www.itscj.ipsj.or.jp/ISO-IR/
64 *
65 * #6 is ASCII. http://www.itscj.ipsj.or.jp/ISO-IR/006.pdf
66 * Escapes into:
67 * G0: ESC 2/8 4/2 ("(B")
68 * G1: ESC 2/9 4/2 (")B")
69 * The range is [0x21 .. 0x7e]. Conversion into Unicode
70 * is simple, because it has one-to-one correspondence.
71 * #87 is a "Japanese Graphic Character Set for Information Interchange".
72 * Is a multiple-byte set of 6877 characters.
73 * The character set is JIS X 0208-1983 (originally JIS C 6226-1983).
74 * Escapes into:
75 * G0: ESC 2/4 4/2 ("$B")
76 * G1: ESC 2/4 2/9 4/2 ("$)B")
77 * G2: ESC 2/4 2/10 4/2 ("$*B")
78 * G3: ESC 2/4 2/11 4/2 ("$+B")
79 * #102 is "Teletex Primary Set of Graphic Characters" and is almost ASCII.
80 * Escapes into:
81 * G0: ESC 2/8 7/5 ("(u")
82 * G1: ESC 2/9 7/5 (")u")
83 * G2: ESC 2/10 7/5 ("*u")
84 * G3: ESC 2/11 7/5 ("+u")
85 * It is almost identical to ASCII, except for ASCII position for '$'
86 * (DOLLAR SIGN) is filled with 'ยค' (CURRENCY SIGN), which is U+00A4.
87 * Also, ASCII positions for '`', '\', '^', '{', '}', '~' are marked
88 * as "should not be used".
89 * #103 is a supplementary set of characters used in combination with #102.
90 * Escapes into:
91 * G0: ESC 2/8 7/6 ("(v")
92 * G1: ESC 2/9 7/6 (")v")
93 * G2: ESC 2/10 7/6 ("*v")
94 * G3: ESC 2/11 7/6 ("+v")
95 * Some characters in that character set are combining characters,
96 * which can only be restrictively used with certain basic Latin letters.
97 * It can be thought of as a subset of #156 with the exception of 4/12
98 * which is UNDERLINE in #103 and absent in #156.
99 * #106 is a primary set of control functions, used in combination with #107.
100 * Escapes into:
101 * C0: ESC 2/1 4/5 ("!E")
102 * This set is so short I can list it here:
103 * 0x08 BS BACKSPACE -- same as Unicode
104 * 0x0a LF LINE FEED -- same as Unicode
105 * 0x0c FF FORM FEED -- same as Unicode
106 * 0x0d CR CARRIAGE RETURN -- same as Unicode
107 * 0x0e LS1 LOCKING SHIFT ONE
108 * 0x0f LS0 LOCKING SHIFT ZERO
109 * 0x19 SS2 SINGLE SHIFT TWO
110 * 0x1a SUB SUBSTITUTE CHARACTER
111 * 0x1b ESC ESCAPE -- same as Unicode
112 * 0x1d SS3 SINGLE SHIFT THREE
113 * The LS1 and LS0 are two magical functions which, respectively, invoke
114 * the currently designated G1 or G0 set into positions 2/1 to 7/14
115 * The SS2 and SS3, respectively, invoke one character of the
116 * currently designated set G2 and G3.
117 * The SUB is wholly equivalent to U+001a (SUBSTITUTE)
118 * #107 is a supplementary set of control functions, used with #106.
119 * Escapes into:
120 * C1: ESC 2/2 4/8 ('"H')
121 * This set contains three special control codes:
122 * 0x8b PLD PARTIAL LINE DOWN -- similar to <SUB>
123 * 0x8c PLU PARTIAL LINE UP -- sumilar to <SUP>
124 * 0x9b CSI CONTROL SEQUENCE INTRODUCER
125 * This set is so out of world we can probably safely ignore it.
126 * #126 is a "Right-hand Part of the Latin/Greek Alphabet".
127 * Comprises of 90 characters, including accented letters.
128 * Escapes into:
129 * G1: ESC 2/13 4/6 ("-F")
130 * G2: ESC 2/14 4/6 (".F")
131 * G3: ESC 2/15 4/6 ("/F")
132 * Note: This Registration is a subset of ISO-IR 227.
133 * #144 is a "Cyrillic part of the Latin/Cyrillic Alphabet".
134 * Comprises of 95 characters.
135 * Escapes into:
136 * G1: ESC 2/13 4/12 ("-L")
137 * G2: ESC 2/14 4/12 (".L")
138 * G3: ESC 2/15 4/12 ("/L")
139 * #150 is a "Greek Primary Set of Graphic Characters".
140 * Comprises of 94 characters.
141 * Escapes into:
142 * G0: ESC 2/8 2/1 4/0 ("(!@")
143 * G1: ESC 2/9 2/1 4/0 (")!@")
144 * G2: ESC 2/10 2/1 4/0 ("*!@")
145 * G3: ESC 2/11 2/1 4/0 ("+!@")
146 * #153 is a "Basic Cyrillic Character Set for 8-bit codes".
147 * Comprises of 68 characters.
148 * Escapes into:
149 * G1: ESC 2/13 4/15 ("-O")
150 * G2: ESC 2/14 4/15 (".O")
151 * G3: ESC 2/15 4/15 ("/O")
152 * #156 is a "Supplementary Set of ISO/IEC 6937:1992" for use with #6
153 * Comprises of 87 characters.
154 * Escapes into:
155 * G1: ESC 2/13 5/2 ("-R")
156 * G2: ESC 2/14 5/2 (".R")
157 * G3: ESC 2/15 5/2 ("/R")
158 * #164 is a "Hebrew Supplementary Set of Graphic Characters"
159 * Comprises of 27 characters.
160 * Escapes into:
161 * G1: ESC 2/13 5/3 ("-S")
162 * G2: ESC 2/14 5/3 (".S")
163 * G3: ESC 2/15 5/3 ("/S")
164 * #165 is a set of "Codes of the Chinese graphic character set"
165 * Is a multiple-byte set of 8446 characters.
166 * Escapes into:
167 * G0: ESC 2/4 2/8 4/5 ("$(E")
168 * G1: ESC 2/4 2/9 4/5 ("$)E")
169 * G2: ESC 2/4 2/10 4/5 ("$*E")
170 * G3: ESC 2/4 2/11 4/5 ("$+E")
171 * #168 is a "Japanese Graphic Character Set for Information Interchange"
172 * A multiple-byte set of 6879 characters updated from #87.
173 * Escapes into:
174 * G0: ESC 2/6 4/0 ESC 2/4 4/2 ("&@" "$B")
175 * G1: ESC 2/6 4/0 ESC 2/4 2/9 4/2 ("&@" "$)B")
176 * G2: ESC 2/6 4/0 ESC 2/4 2/10 4/2 ("&@" "$*B")
177 * G3: ESC 2/6 4/0 ESC 2/4 2/11 4/2 ("&@" "$+B")
178 */
179