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