Description
The text with "ISO-2022-JP-2" starts in ASCII [ASCII], and switches to other character sets of ISO 2022 [ISO2022] through limited combinations of escape sequences. All the characters are encoded with 7 bits only. At the beginning of text, the existence of an announcer sequence: "ESC 2/0 4/1 ESC 2/0 4/6 ESC 2/0 5/10" is (though omitted) assumed. Thus, characters of 94 character sets are designated to G0 and invoked as GL. C1 control characters are represented with 7 bits. Characters of 96 character sets are designated to G2 and invoked with SS2 (single shift two, "ESC 4/14" or "ESC N"). For example, the escape sequence "ESC 2/4 2/8 4/3" or "ESC $ ( C" indicates that the bytes following the escape sequence are Korean KSC characters, which are encoded in two bytes each. The escape sequence "ESC 2/14 4/1" or "ESC . A" indicates that ISO 8859-1 is designated to G2. After the designation, the single shifted sequence "ESC 4/14 4/1" or "ESC N A" is interpreted to represent a character "A with acute". The following table gives the escape sequences and the character sets used in "ISO-2022-JP-2" messages. The reg# is the registration number in ISO's registry [ISOREG].
94 character sets
reg# character set ESC sequence designated to
------------------------------------------------------------------
6 ASCII ESC 2/8 4/2 ESC ( B G0
42 JIS X 0208-1978 ESC 2/4 4/0 ESC $ @ G0
87 JIS X 0208-1983 ESC 2/4 4/2 ESC $ B G0
14 JIS X 0201-Roman ESC 2/8 4/10 ESC ( J G0
58 GB2312-1980 ESC 2/4 4/1 ESC $ A G0
149 KSC5601-1987 ESC 2/4 2/8 4/3 ESC $ ( C G0
159 JIS X 0212-1990 ESC 2/4 2/8 4/4 ESC $ ( D G0
96 character sets
reg# character set ESC sequence designated to
------------------------------------------------------------------
100 ISO8859-1 ESC 2/14 4/1 ESC . A G2
126 ISO8859-7(Greek) ESC 2/14 4/6 ESC . F G2
For further information about the character sets and the escape sequences, see [ISO2022] and [ISOREG]. If there is any G0 designation in text, there must be a switch to ASCII or to JIS X 0201-Roman before a space character (but not necessarily before "ESC 4/14 2/0" or "ESC N ' '") or control characters such as tab or CRLF. This means that the next line starts in the character set that was switched to before the end of the previous line. Though the designation to JIS X 0201-Roman is allowed for backward compatibility to "ISO-2022-JP", its use is discouraged. Applications such as pagers and editors which randomly seek within a text file encoded with "ISO-2022-JP-2" may assume that all the lines begin with ASCII, not with JIS X 0201-Roman. At the beginning of a line, information on G2 designation of the previous line is cleared. New designation must be given before a character in 96 character sets is used in the line. The text must end in ASCII designated to G0. As the "ISO-2022-JP", and thus, "ISO-2022-JP-2", is designed to represent English and modern Japanese, left-to-right directionality is assumed if the text is displayed horizontally. Users of "ISO-2022-JP-2" must be aware that some common transport such as old Bnews can not relay a 7-bit value 7/15 (decimal 127), which is used to encode, say, "y with diaeresis" of ISO 8859-1.