home *** CD-ROM | disk | FTP | other *** search
/ Columbia Kermit / kermit.zip / e / isok5.txt < prev    next >
Text File  |  2020-01-01  |  107KB  |  2,135 lines

  1.                  ********************
  2.     NOTE: THIS VERSION IS OBSOLETE, AND HAS BEEN SUPERSEDED BY ISOK6.TXT.
  3.                  ********************
  4.  
  5.  
  6.          A KERMIT PROTOCOL EXTENSION FOR INTERNATIONAL CHARACTER SETS
  7.  
  8.                   Christine Gianone
  9.          Manager, Kermit Development and Distribution
  10.              Columbia University Center for Computing Activities
  11.                             612 West 115th Street
  12.                            New York, NY 10025, USA
  13.  
  14.                                 DRAFT NUMBER 5
  15.                                 APRIL 25, 1990
  16.  
  17. ABSTRACT
  18.  
  19. A two-level extension to the presentation layer of the Kermit file transfer
  20. protocol is proposed to allow transfer of non-English-language text files
  21. between unlike computers.  Level 1 allows substitution of single character
  22. sets other than ASCII in Kermit's normal text-file transfer syntax.  Level 2
  23. specifies a new transfer syntax in which multiple character sets may be used,
  24. along with mechanisms for switching among them as defined in ISO Standard
  25. 2022.
  26.  
  27. This is still a DRAFT proposal.  Readers with knowledge of real-world
  28. multi-alphabet applications and file formats are urged to comment on the
  29. suitability of this proposal.  It is assumed the reader is familiar with the
  30. Kermit file transfer protocol.  It is also assumed that the reader is
  31. familiar with ISO Standards 4873 and 2022, but these are summarized in
  32. Appendix B.
  33.  
  34.  
  35. SUMMARY OF CHANGES SINCE DRAFT #4, August, 1989
  36.  
  37.  - Changes for Level 1 only, to reflect experience in writing the code
  38.    to implement it for MS-DOS Kermit 3.0, C-Kermit 5A, and Kermit 370 4.2.
  39.    Level 2 is on hold indefinitely pending ISO 10646 & Unicode developments.
  40.  - Abandonment of separate attributes for encoding and character set.
  41.  - Change all references to ASCII as I2 into I6.
  42.  - Change description of SET LANGUAGE to remove side effects.
  43.  - Differentiation of SET TRANSFER CHARACTER ASCII and TRANSPARENT.
  44.  - The section on terminal emulation has not been changed, even though
  45.    this subject needs detailed treatment in this document.
  46.  
  47. SUMMARY OF CHANGES SINCE DRAFT #3, July 20, 1989
  48.  
  49.  - Expanded & more precise definition of Kermit's character set designators
  50.  - Simplification of the syntax of the (former) SET TRANSFER-SYNTAX command
  51.  - Addition of SET LANGUAGE command
  52.  - Clarification of Kermit's behavior when it receives an unknown character set
  53.  - Addition of Appendix F to specify how each Kermit Level is invoked
  54.  - Correction of numerous typographical and other errors
  55.  
  56. ACKNOWLEDGEMENTS
  57.  
  58. Many thanks to these people for their helpful and constructive comments on the
  59. first three drafts.  In most cases, their suggestions or the information they
  60. provided have been incorporated into this or previous drafts.
  61.  
  62.   John Chandler (Harvard/Smithsonian Center for Astrophysics, USA)
  63.   Alan Curtis (University of London, UK)
  64.   Frank da Cruz (Columbia University, USA)
  65.   Joe Doupnik (Utah State University, USA)
  66.   Hirofumi Fujii (Japan National Laboratory of High Energy Physics, Tokyo)
  67.   John Klensin (Massachusetts Institute of Technology, USA)
  68.   Ken-ichiro Murakami (Nippon Telephone and Telegraph Research Labs, Tokyo)
  69.   Vladimir Novikov (VNIIPAS, Moscow, USSR)
  70.   Jacob Palme (Stockholm University, Sweden)
  71.   Andre Pirard (University of Liege, Belgium)
  72.   Paul Placeway (Ohio State University, USA)
  73.   Gisbert W. Selke (University of Bonn, West Germany)
  74.   Fridrik Skulason (University of Iceland, Reykjavik)
  75.   Johan van Wingen (Leiden, Netherlands)
  76.   Konstantin Vinogradov (ICSTI, Moscow, USSR)
  77.   Amanda Walker (InterCon Systems Corp, USA)
  78.  
  79. Thanks also to the following people for organizing meetings or conferences
  80. in their countries at which the issues of this proposal were discussed:
  81.  
  82.   Kohichi Nishimoto (Nihon DEC, Tokyo, Japan)
  83.   Juri Gornostaev and A. Butrimenko (ICSTI, Moscow, USSR)
  84.  
  85. and thanks also to those who attended these gatherings!
  86.  
  87.  
  88. STATEMENT OF THE PROBLEM
  89.  
  90. Kermit has always been able to transfer text files between unlike systems
  91. (e.g. a UNIX system with ASCII stream text files and an IBM mainframe with
  92. EBCDIC record-oriented text files).  To do the text file code conversion,
  93. Kermit transfers text in ASCII.  But ASCII only includes enough letters and
  94. symbols for English.
  95.  
  96. There are now computers capable of representing the characters of other
  97. languages: Roman letters with diacritical marks, Cyrillic letters, Hebrew,
  98. Arabic, and Greek characters, Japanese and Chinese ideograms.  But different
  99. computer manufacturers use different codes for these characters.
  100.  
  101. For example, the IBM PS/2 and the Apple Macintosh have character sets that are
  102. "8-bit ASCII".  When the character value is 32-127, the character is
  103. (normally) a standard ASCII graphic (printable) character.  When the value is
  104. 128 or higher, it is a special character.  But the PC and the Macintosh assign
  105. different special characters to these values.  Here are just a few examples:
  106.  
  107.    Value     PS/2 Character      Macintosh Character
  108.     138       Small e grave       Small a umlaut
  109.     143       Capital A ring      Small e grave
  110.     144       Capital E acute     Small e circumflex 
  111.     136       Small e circumflex  Small a grave
  112.  
  113. When a file contains "8-bit ASCII", Kermit presently transfers it without any
  114. character translation.  Therefore, a text file written in French, German,
  115. Italian, or Norwegian transferred between a PS/2 and a Macintosh will contain
  116. the wrong characters when it arrives at its destination: the PS/2's e-grave
  117. becomes a-umlaut on the Macintosh, etc.
  118.  
  119. The problem is compounded when a file is composed of characters from more than
  120. one character set, for example a Japanese text file that contains Kanji,
  121. Katakana, and Roman characters.
  122.  
  123. There are many computer vendors in the world and nobody controls what codes
  124. they use to represent characters.  Without a standard protocol for
  125. transferring non-ASCII text, each computer would have to know the codes of all
  126. the other computers in order for correct transfer of non-English text files to
  127. occur between unlike systems.
  128.  
  129.  
  130. NORMAL KERMIT FILE TRANSFER SYNTAX
  131.  
  132. The Kermit file transfer protocol makes a distinction between text and binary
  133. files.  Binary files are transmitted with no translation or conversion.  For
  134. text files, the Kermit protocol defines a standard transfer syntax for text
  135. files, namely ASCII characters with carriage return and linefeed (CRLF) after
  136. each line, so that text may be stored in useful fashion on any computer to
  137. which it is transferred.  Each Kermit program knows how to translate from the
  138. local text-file storage conventions to ASCII/CRLF syntax, and vice versa.
  139. This is the basic, required, and default mode of operation for any Kermit
  140. program, and it will be referred to as Kermit's "Normal" or "Level 0" syntax.
  141.  
  142.  
  143. EXPANDED KERMIT TRANSFER SYNTAX
  144.  
  145. This proposal adds two additional levels of transfer syntax, Levels 1 and 2.
  146. Level 1 permits the use of a single character set other than ASCII in the
  147. transfer syntax.  These additional character sets are taken from recognized
  148. national or international standards, such as ISO 8859-1 (Latin Alphabet 1),
  149. JIS X 0208 (Japanese), etc.
  150.  
  151. By using a standard character set (other than ASCII), it is possible to
  152. transfer a text file written in a language other than English, and it is also
  153. possible to transfer a text file containing more than one language.  For
  154. example Latin Alphabet 1 can represent a file containing a mixture of Italian,
  155. Norwegian, French, German, English, and Icelandic.
  156.  
  157. Level 2 allows a mixture of character sets to transfer mixed-language text
  158. that requires characters from more than one standard character set, for
  159. example a document written in Russian, French, and Greek.
  160.  
  161. The additional levels are optional features for Kermit programs, except that
  162. Level 2 should not be provided without Level 1.
  163.  
  164. The following discussion applies to text-file transfer only.  When the Kermit
  165. user has selected binary file transfer, none of the text-file conversions
  166. discussed here apply.
  167.  
  168.  
  169. EXPANDED SYNTAX, LEVEL 1
  170.  
  171. When all the characters in a text file can be represented by a single
  172. character set, then that character set can be used in place of ASCII in
  173. Kermit's transfer syntax.
  174.  
  175. Whatever the transfer character set, there must be a mapping between the local
  176. file character set and the character set of the common transfer syntax.  That
  177. is, there must be a pair of translation functions in the program, one from the
  178. local file character set to the transfer character set, and one from the
  179. transfer set to the local set.
  180.  
  181. Until now, many Kermit programs have lacked such a translation function,
  182. because the local file character set was the same as the transfer character
  183. set, namely ASCII.  But there have always been exceptions.  For example, IBM
  184. System/370 mainframe Kermit must translate between ASCII and its local EBCDIC
  185. character set.
  186.  
  187. To complicate matters, many computers now support a variety of character sets.
  188. IBM mainframes have not only "standard" US EBCDIC, but also several
  189. EBCDIC-based Country Extended Code Pages (CECPs) for the support of West
  190. European languages, Hebrew, etc.  The IBM PC and PS/2 have a variety of
  191. ASCII-based 8-bit code pages for the same purpose.  These character sets are a
  192. welcome addition, because they allow users of these computers to create,
  193. display, and print documents in languages other than English.  Unfortunately,
  194. it is usually the case that the computer's file system keeps no record of
  195. which character set is used in each file.
  196.  
  197. For this reason, the following command should be provided to allow the Kermit
  198. user to specify the local file character set:
  199.  
  200.   SET FILE CHARACTER-SET <file-character-set-name>
  201.  
  202. The file character set name is a system-dependent item.  Some computers have
  203. only one character set, in which case the SET FILE CHARACTER-SET command would
  204. be unnecessary.
  205.  
  206. This command will be necessary on computers that use the "national replacement
  207. characters" allowed by ISO Standard 646.  This standard specifies a 7-bit
  208. character set equivalent to ASCII, but with national variants in which certain
  209. non-alphanumeric ASCII graphic characters are replaced by "national
  210. characters", as shown in Table 1.
  211.  
  212. _____________________________________________________________________________
  213.  
  214. Column/Row   ASCII          German         Finnish   Norwegian     French
  215.  
  216.   04/00      at-sign        section       at-sign   at-sign       a-grave
  217.   05/11      left-bracket   A-umlaut      A-umlaut  AE-digraph    degree
  218.   05/12      backslash      O-umlaut      O-umlaut  O-slash       c-cedilla
  219.   05/13      right-bracket  U-umlaut      A-circle  A-circle      section  
  220.   06/00      accent-grave   accent-grave  e-acute   accent-grave  accent-grave
  221.   07/11      left-brace     a-umlaut      a-umlaut  ae-digraph    e-acute
  222.   07/12      vertical-bar   o-umlaut      o-umlaut  o-circle      u-grave
  223.   07/13      right-brace    u-umlaut      a-circle  a-circle      e-grave
  224.   07/14      tilde          ess-zet       u-umlaut  tilde         umlaut
  225.  
  226.            Table 1: ISO 646 Usage in Selected Countries
  227. _____________________________________________________________________________
  228.  
  229. (see Figure 1 in Appendix B for an explanation of column/row notation.)
  230.  
  231. For example, the German phrase "Gr<u-umlaut><ess-zet>e aus K<o-umlaut>ln"
  232. would be rendered in ASCII as "Gr}~e aus K|ln", and the ASCII C-language
  233. phrase "{~a[x]}" would become:
  234.  
  235.   <a-umlaut><ess-zet>a<A-umlaut>x<U-umlaut><u-umlaut>
  236.  
  237. in German ISO 646.  The German user would want Kermit to interpret the local
  238. file characters as German in the former case, and as ASCII in the latter.
  239.  
  240.  
  241. SPECIFYING THE TRANSFER CHARACTER SET:
  242.  
  243. To select Level 1, the user enters the command:
  244.  
  245.   SET TRANSFER CHARACTER-SET <name>
  246.  
  247. Where <name> is the name of a standard character set other than ASCII.  If the
  248. name is TRANSPARENT, then Kermit does no character set conversion at all, but
  249. it still may do text record format conversion.  For ASCII-based systems, this
  250. is equivalent to Kermit's normal, basic mode of operation.
  251.  
  252. If a name other than TRANSPARENT is given, and FILE TYPE is set to TEXT,
  253. then Kermit will translate between the current file character set and the
  254. named transfer character set during all packet operations.  If the transfer
  255. character set is ASCII, then Kermit converts between the current file
  256. character set and 7-bit ASCII.  This mode of operation is roughly equivalent
  257. to Kermit's basic mode of operation on non-ASCII based systems like IBM
  258. mainframes.  If the local file character set contains accented characters, the
  259. accents are dropped in the transfer character set, for example a-acute becomes
  260. simply a.  (But see SET LANGUAGE, described later.)
  261.  
  262. Other transfer character sets must be chosen from among approved national or
  263. international standards.  As a starting point, the sets shown in Table 2 are
  264. recommended.  The criteria for including a character set in this table are:
  265.  
  266. 1. 7-bit ASCII (= ISO-646 International Reference Version, IRV) is included,
  267.    for compatibility with the original Kermit protocol and the hundreds of
  268.    programs that implement it.
  269.  
  270. 2. An 8-bit single-byte character set, such those in the ISO 8859 series,
  271.    if it is registered, as in (4) below, is included.
  272.  
  273. 3. A multibyte character set may be included, if it is registered as in (4).
  274.  
  275. 4. The set must be listed in the ISO International Register of Character Sets
  276.    under the provisions of ISO Standard 2375 (see Appendix A), so that it has
  277.    a unique registration number and designating escape sequence, in order that
  278.    the sending Kermit program can identify the character set to the receiving
  279.    Kermit program.  Allowance is made for the possibility of other
  280.    registration authorities, should they appear.
  281.  
  282. 5. The set must be a national or international standard graphic character 
  283.    set, intended for use in computer text processing or programming (as
  284.    opposed to Videotex, Teletex, OCR, device control, or other applications).
  285.    This category may include line-drawing or technical character sets which
  286.    fit the other criteria.
  287.  
  288. Note in particular that the national variants of ISO 646 are not included,
  289. since these are covered adequately by ASCII and the ISO Latin alphabets.
  290.  
  291. Standard "Kermit names" (for use with the SET TRANSFER CHARACTER-SET command)
  292. are given to these character sets so that they may be referred to uniformly in
  293. all Kermit implementations.  These names are chosen to be mnemonic, so that
  294. users don't have to remember cryptic designations like "ISO-8859-3".  The
  295. choice of single words like "CYRILLIC" implies that there will not be more
  296. than one Level-1 transfer syntax for Cyrillic text.  However, if these
  297. standards change in the future, it will be possible to add further identifying
  298. material to these names, e.g. "CYRILLIC2", "CYRILLIC3", etc.
  299.  
  300. The mnemonicity of the Kermit names is based upon English, as this is the
  301. language of the standards themselves.  The Kermit commands are English words,
  302. and this document is written in English.  Once we have solved the problem of
  303. transferring non-English text files between unlike computers, we may begin to
  304. consider the challenge of language-independent user interfaces and
  305. documentation!
  306.  
  307. _____________________________________________________________________________
  308.  
  309.             Table 2: Standard 8-Bit Character Sets
  310.  
  311. US 7-bit ASCII, English, Latin, Gaelic, German without umlauts or ess-zet, etc.
  312.   Kermit name: ASCII.
  313.   ISO Registration Number: 6.
  314.   Kermit Designator: none (this is the default transfer alphabet).
  315.  
  316. ISO 8859-1, Latin Alphabet 1, for Dutch, English, Faeroese, Finnish, French,
  317.   German, Icelandic, Irish, Italian, Norwegian, Portuguese, Spanish, 
  318.   and Swedish.
  319.   Kermit name: LATIN1.
  320.   ISO Registration Number: 100.
  321.   Kermit Designator: I6/100.  
  322.  
  323. ISO 8859-2, Latin Alphabet 2.  Albanian, Czech, English, German, Hungarian,
  324.   Polish, Romanian, Serbocroatian (Croatian), Slovak, and Slovene.
  325.   Kermit name: LATIN2.
  326.   ISO Registration Number: 101.
  327.   Kermit Designator: I6/101.
  328.  
  329. ISO 8859-3, Latin Alphabet 3, for Afrikaans, Catalan, English, Esperanto,
  330.   French, Galician, German, Italian, Maltese, and Turkish.
  331.   Kermit name: LATIN3.
  332.   ISO Registration Number: 109.
  333.   Kermit Designator: I6/109.
  334.  
  335. ISO 8859-4, Latin Alphabet 4, for Danish, English, Estonian, Finnish, German,
  336.   Greenlandic, Lappish, Latvian, Lithuanian, Norwegian, and Swedish.
  337.   Kermit name: LATIN4.
  338.   ISO Registration Number: 110.
  339.   Kermit Designator: I6/110.
  340.  
  341. ISO 8859-5, the Latin/Cyrillic Alphabet, for Bulgarian, Byelorussian, English,
  342.   Macedonian, Russian, Serbocroatian (Serbian), and Ukrainian
  343.   (Compatible with USSR GOST Standard 19768-1987 and ECMA-113).
  344.   Kermit name: CYRILLIC.
  345.   ISO Registration Number: 144.
  346.   Kermit Designator: I6/144.
  347.  
  348. ISO 8859-6, the Latin/Arabic Alphabet.
  349.   Kermit name: ARABIC.
  350.   ISO Registration Number: 127.
  351.   Kermit Designator: I6/127.
  352.  
  353. ISO 8859-7, the Latin/Greek Alphabet.
  354.   Kermit name: GREEK.
  355.   ISO Registration Number: 126.
  356.   Kermit Designator: I6/126.
  357.  
  358. ISO 8859-8, the Latin/Hebrew Alphabet.
  359.   Kermit name: HEBREW.
  360.   ISO Registration Number: 138.
  361.   Kermit Designator: I6/138.
  362.  
  363. ISO DIS 8859-9, Latin Alphabet 5, in which six Icelandic letters from
  364.   Latin Alphabet 1 are replaced by six other letters needed for Turkish.
  365.   Kermit name: LATIN5.
  366.   ISO Registration Number: 148.
  367.   Kermit Designator: I6/148.
  368.  
  369. CSN 36 91 03, Czechoslovak Standard alphabet.
  370.   Kermit name: CZECH.
  371.   ISO Registration Number: 139.
  372.   Kermit Designator: I6/139.
  373.  
  374. JIS X 0201, a 1-byte code for Japanese Katakana, used in conjunction
  375.   with a slightly modified ASCII (backslash is replaced by Yen sign,
  376.   tilde by overbar).
  377.   Kermit name: KATAKANA.
  378.   ISO Registration Numbers: 14 (Roman), 13 (Katakana).
  379.   Kermit Designator: I14/13.
  380.  
  381. JIS X 0208, a 2-byte code containing Japanese Kanji, Katakana, Hiragana,
  382.   Roman, Greek, and Russian characters, plus special symbols, etc.  All
  383.   characters in this set are displayed in double width, therefore it is
  384.   commonly used in conjunction with JIS X 0201 so that Katakana and Roman
  385.   characters and digits may be displayed in single width.
  386.   Kermit name: KANJI.
  387.   ISO Registration Number: 87.
  388.   Kermit Designator: M87.
  389.  
  390. Chinese Standard GB 2312-80, a 2-byte code for Chinese.
  391.   Kermit name: CHINESE.
  392.   ISO Registration Number: 58.
  393.   Kermit Designator: M58.
  394.  
  395. KS C 5601 (1987), a 2-byte code for Korean.
  396.   Kermit name: KOREAN.
  397.   ISO Registration Number: 149.
  398.   Kermit Designator: M149.
  399.  
  400.             Table 2: Standard 8-Bit Character Sets
  401. _____________________________________________________________________________
  402.  
  403. The ISO Latin alphabets and the Czech character set are 8-bit character sets
  404. whose left half is identical with ASCII, and whose right half contains the
  405. special characters.  The ISO registration number refers only to the right half
  406. of each of these character sets.  But each of these sets must be used in its
  407. entirety, because the unaccented Roman letters, the digits, and the
  408. punctuation marks appear only in the ASCII left half, which is ALWAYS (unless
  409. otherwise noted) US ASCII, ISO Registration Number 6.  The Kermit
  410. character-set name refers to the two halves combined as a single set.
  411.  
  412. A particular Kermit program need not incorporate all of these character sets.
  413. In many cases, a single 8-bit character set will suffice, such as LATIN1 for
  414. Western Europe, LATIN2 for Eastern European countries with Roman-alphabet
  415. based languages, LATIN4 for Scandinavia, CYRILLIC for most of the USSR, etc.
  416.  
  417. When a language is representable in more than one character set from this
  418. table, as are English, German, Finnish, Czech, Turkish, etc., the character
  419. set highest on the list which adequately represents the language should be
  420. preferred.  More precisely, when a character set other than ASCII is to be
  421. used in the Kermit's transfer syntax, the ISO 8859 sets are preferred to other
  422. registered sets which contain the same characters.  Within the ISO 8859
  423. family, lower-numbered sets which contain the characters of interest are
  424. preferred to higher-numbered sets which contain the same characters.
  425. This guideline maximizes the chance that any two particular Kermit programs
  426. will recognize the same character sets.
  427.  
  428. For example, LATIN1 would be chosen for French, LATIN1 for German (because it
  429. represents German better than ASCII), LATIN5 for Turkish (because it
  430. represents Turkish better than LATIN3), KANJI or KATAKANA for Japanese
  431. (because none of the ISO 8859 sets contain Japanese characters), etc.
  432.  
  433. Unfortunately, but unavoidably, the burden of choosing the best transfer
  434. syntax character set must be placed upon the user.  If a file containing a
  435. mixture of Finnish, English, and Danish must be transferred, the user must
  436. find a character set that can adequately represent all three languages, in
  437. this case Latin Alphabet 4.  A table like Table 3 should be provided in the
  438. user documentation to help the user make this selection.
  439.  
  440. _____________________________________________________________________________
  441.  
  442.     Arabic     ARABIC                      Italian        LATIN1,3
  443.     Bulgarian  CYRILLIC                    Kanji          KANJI
  444.     Chinese    CHINESE                     Katakana       KATAKANA, KANJI
  445.     Czech      CZECH, LATIN2               Korean         KOREAN
  446.     Danish     LATIN4                      Latvian        LATIN4
  447.     Dutch      LATIN1,2,3,4                Lithuanian     LATIN4
  448.     English    ASCII,LATIN1,2,3,4,5,etc    Norwegian      LATIN1,4
  449.     Esperanto  LATIN3                      Polish         LATIN2
  450.     Estonian   LATIN4                      Portuguese     LATIN1
  451.     Finnish    LATIN1,4                    Romanian       LATIN2
  452.     Flemish    LATIN1,2,3,4,5              Russian        CYRILLIC
  453.     French     LATIN1,3,5                 *Serbocroatian  LATIN2, CYRILLIC
  454.     German     LATIN1,2,3,4,5              Slovak         LATIN2
  455.     Greek      GREEK                       Spanish        LATIN1
  456.     Hebrew     HEBREW                      Swedish        LATIN1,4
  457.     Hungarian  LATIN2                      Turkish        LATIN5,3
  458.     Icelandic  LATIN1                      Ukrainian      CYRILLIC
  459.  
  460.           Table 3: Preferred Transfer Syntax Character Sets
  461.  
  462. *If written in Cyrillic, this language is called Serbian.  If written
  463.  in Roman letters, it is called Croatian.
  464. _____________________________________________________________________________
  465.  
  466. Note, table 3 is only a sample.  To produce a comprehensive and definitive
  467. table would require a team of language experts.  The information in the
  468. current table is based purely upon the claims made within the standards
  469. themselves, in which there is no mention of languages like Albanian, Erse,
  470. Farsi, Urdu, Welsh, Cornish, Manx, Inuit, Old Church Slavonic, Armenian,
  471. Georgian, Tagalog, Swahili, Latin, Vietnamese, etc, nor definitions of
  472. exactly what is meant by terms like "Greenlandic", "Irish", etc.  Obviously,
  473. it is the intention of this proposal to support any language for which a
  474. computer character set can be standardized.
  475.  
  476. IMPLEMENTATION OF LEVEL 1
  477.  
  478. The Level-1 Kermit extension can be added to existing Kermit programs with
  479. a minimum of effort.  The following steps are required for each Kermit program:
  480.  
  481. 1. Add the SET FILE TYPE { BINARY, TEXT } command, if the program doesn't
  482.    have it already.  SET FILE TYPE TEXT enables text-file character set
  483.    conversion at all levels.  SET FILE TYPE BINARY disables conversions of
  484.    all kinds, but does not destroy the file and transfer character-set
  485.    selections (2 and 3 below), so that a subsequent SET FILE TYPE TEXT
  486.    command will still be able to use them.
  487.  
  488. 2. Add the SET FILE CHARACTER-SET <name> command.  The set of <names> should
  489.    include ASCII or EBCDIC (as appropriate, used for program source, etc) plus
  490.    the names of any "national" or special character sets that are used on this
  491.    particular computer.
  492.  
  493. 3. Add the SET TRANSFER CHARACTER-SET <name> command.  The set of <names>
  494.    should include TRANSPARENT and ASCII plus the names of one or more other
  495.    standard character sets from Table 2 which contain the characters from the
  496.    computer's local character set(s).
  497.  
  498. 4. Add translation tables (or functions) between each pair of character sets
  499.    in (2) and (3).  For each pair, two translation tables are necessary: one
  500.    from the local file character set to the transfer character set, and one
  501.    from the transfer set to the local one.
  502.  
  503. 5. Add SHOW commands to let the user find out what character sets are
  504.    available, and which ones are currently selected, for the transfer syntax
  505.    and for local files.  The exact syntax of this command will vary.  In
  506.    some Kermit implementations, every SET command has a corresponding SHOW
  507.    command, in which case it will be possible to SHOW FILE CHARACTER-SET and
  508.    SHOW TRANSFER CHARACTER-SET.  In others, related SET parameters are lumped
  509.    together into broader categories for purposes of SHOW, for example SHOW
  510.    FILE would show all file-related parameters; SHOW PROTOCOL would show all
  511.    protocol-related parameters.
  512.    
  513. Optionally, several additional related commands may be included:
  514.  
  515. 6. The command SET LANGUAGE may be added to allows the program to apply
  516.    heuristics in the translation process that would not otherwise be possible
  517.    (see discussion of German below).  The choices for SET LANGUAGE should
  518.    include ASCII (for transferring program source code, etc) plus the names of
  519.    any languages the particular Kermit implementation supports, such as
  520.    ITALIAN, NORWEGIAN, PORTUGUESE.
  521.  
  522. 7. To allow for user-defined character-set translations, also add the LOAD
  523.    TRANSLATION-TABLE, SHOW TRANSLATION-TABLE, and DUMP TRANSLATION-TABLE
  524.    commands (described in the next section).
  525.  
  526. 8. Once the new commands and translation tables are in place, it is simple to
  527.    add a TRANSLATE command, to translate a local file from one character set
  528.    to another.  With this command, Kermit may be used as a character-set
  529.    conversion utility for local files.
  530.  
  531. LEVEL-1 EXAMPLE
  532.  
  533. To transfer a Finnish-language text file from a computer that uses the Finnish
  534. ISO 646 national replacement set to an IBM PS/2, and to store the file using
  535. the PS/2's Multilingual Code Page:
  536.  
  537.   On the sending computer:               On the receiving computer:
  538.     SET FILE TYPE TEXT                     SET FILE TYPE TEXT
  539.     SET FILE CHARACTER-SET FINNISH         SET TRANSFER CHARACTER-SET LATIN1
  540.     SET TRANSFER CHARACTER-SET LATIN1      SET FILE CHARACTER-SET CP850
  541.     SEND filename                          RECEIVE
  542.  
  543. To transfer a C-language source program between the same two computers:
  544.  
  545.   On the sending computer:               On the receiving computer:
  546.     SET FILE TYPE TEXT                     SET FILE TYPE TEXT
  547.     SET TRANSFER CHARACTER-SET ASCII       SET FILE CHARACTER-SET ASCII
  548.     SET FILE CHARACTER-SET ASCII           SET TRANSFER CHARACTER-SET ASCII
  549.     SEND filename                          RECEIVE
  550.  
  551. To emphasize the value of the SET LANGUAGE command, consider German text
  552. containing the Ess-Zet character and vowels with umlauts.  It is acceptable
  553. to render Ess-Zet as "ss", and to render a vowel with umlaut as the same
  554. vowel without an umlaut but followed by "e".  But this should not necessarily
  555. be done for languages other than German.  The command SET LANGUAGE GERMAN
  556. would allow the Kermit program to perform these functions when translating
  557. from Latin-1 or German NRC into ASCII, so that "Gr<u-umlaut><ess-zet>e aus
  558. K<o-umlaut>ln" would become "Gruesse aus Koeln" (correct German) rather than
  559. "Gruse aus Koln" (Gruse means something entirely different from Gruesse --
  560. something like "scum" rather than "greetings").
  561.  
  562. TRANSLATION TABLES
  563.  
  564. In many cases, translation tables will be 1-for-1.  That is, the two character
  565. sets are the same size, and each character from one set can be found in the
  566. other set.  In such cases, the translation table need be only a list of
  567. numbers, in which position "n" in the table contains the translation for
  568. character number "n".
  569.  
  570. In some cases, the two character sets will be the same size, but certain
  571. characters from one will be lacking in the other, and/or vice versa.  For
  572. example, IBM Code Page 850 and the Apple Macintosh sets are both "8-bit
  573. ASCII", but the IBM set lacks the Macintosh's Y-umlaut, and the Macintosh
  574. set lacks IBM's Y-acute.
  575.  
  576. In other cases the character sets will be different sizes.  We have long been
  577. familiar with this problem when translating between 7-bit ASCII and 8-bit
  578. EBCDIC.  In Japan, there must be translations between single-byte Roman,
  579. Greek, and Cyrillic characters and the two-byte JIS X 0208 character set.
  580.  
  581. It is recommended that translation tables built into Kermit programs be as
  582. general and useful as possible, substituting the closest possible character
  583. when an exact match is not available.  For instance, when translating from
  584. French Latin-1 or NRC to ASCII, accented letters should normally be
  585. translated into the corresponding unaccented letters: a-acute becomes a, etc.
  586.  
  587. It is a matter of choice to the programmer whether translation be accomplished
  588. by tables or by functions which implement translation algorithms, or a
  589. combination of both.  Functions provide maximum flexibility and tend to reduce
  590. program size, at some cost in execution overhead.  Tables provide greatest
  591. speed, with generally greater cost in program size.
  592.  
  593. It is further recommended that the actual contents of each translation table
  594. eventually be specified in this standard, and that translations be invertible.
  595.  
  596. USER-DEFINED TRANSLATIONS
  597.  
  598. It should be possible for users to alter Kermit's translation tables or to add
  599. new ones, without having to change the program's source code.  For example, in
  600. certain situations it might be preferable to have a-grave rendered in ASCII as
  601. "a", but in others as "`a", "a`", or even "?".  It is also possible that new
  602. character sets will appear which are unknown to the Kermit program.
  603.  
  604. For these reasons, a standard format is suggested for translation tables,
  605. together with a LOAD TRANSLATION-TABLE command to allow the user to add new
  606. character sets to a Kermit program's repertoire, or to alter current
  607. translations.
  608.  
  609. Each table within a program is assigned an arbitrary tablename.  For example,
  610. LATIN1-CP850 could be the name for the Latin-1 to CP850 table in the PS/2, and
  611. CP850-LATIN1 could be the name for the table in the other direction.  To load
  612. a replacement table, the user would issue the command:
  613.  
  614.   LOAD TRANSLATION-TABLE <tablename> <filename>
  615.  
  616. where <tablename> is the name to assign to the new table.  If a table with
  617. that name already existed, that table is replaced.  A suggested layout for a
  618. loadable translation table is given in Appendix C.
  619.  
  620. A Kermit program, upon loading one of these files, would set up the
  621. translation table, add the names of the table and of the character sets
  622. themselves to the appropriate keyword tables, and so on.
  623.  
  624. So that the translation-table related commands can also be effective for
  625. built-in translation tables, it is recommended that the built-in tables be
  626. designed in the same format as the loadable tables.
  627.  
  628. Two additional commands should be furnished to allow the user to get
  629. information about the currently loaded tables:
  630.  
  631.   SHOW TRANSLATION-TABLE <tablename>
  632.  
  633. which would give summary information, and:
  634.  
  635.   DUMP TRANSLATION-TABLE <tablename> <filename>
  636.  
  637. which would write out a translation table (even a built-in one) in the form
  638. shown in Appendix C, so that it could be edited and loaded again.
  639.  
  640.  
  641. ATTRIBUTE PACKETS AT LEVEL 1
  642.  
  643. The objective of Kermit's Level-1 extension is to accommodate as many
  644. computers as possible with a minimum of programming effort.  But this approach
  645. places a burden on the user in the form of new commands and the confusion
  646. which results if the user forgets to issue these commands.
  647.  
  648. Level 1 does not require support for Kermit File Attribute Packets, whose use
  649. is negotiated in the Kermit Initialization exchange.  But the user's burden
  650. can be alleviated if the sending Kermit program uses an attribute field to
  651. inform the receiving Kermit of the character set to be used in the transfer
  652. syntax.  The receiving program can accept or refuse the file based on whether
  653. it supports the specified character set.  If the receiving program refuses a
  654. file, the user can override this refusal, for example, if a long file contains
  655. only a word or two in an unknown character set.  The most common user-override
  656. is the command SET ATTRIBUTES OFF.  However, this also disables other
  657. desirable effects of attribute packets, such as prenotification of file size.
  658. Therefore, it is desirable to let the user specify exactly which attributes
  659. are to be "turned off", e.g. SET ATTRIBUTES CHARACTER-SET OFF.
  660.  
  661. When the transfer character set is ASCII (or TRANSPARENT when sent from an
  662. ASCII-based system), the Encoding attribute alone will suffice, with a value
  663. of "A" (for ASCII): "*!A".
  664.  
  665. In order for the sender to inform the receiver of transfer alphabets other
  666. than ASCII, a new value for the Encoding attribute ("*") is defined, namely
  667. "C", which is substituted for the normal value "A" (ASCII).  "C" means that
  668. the actual character set is specified as an operand of the following form
  669. which begins with a single letter that designates the character set
  670. registration authority, e.g. I for ISO, followed by a
  671. registration-authority-specific identifier, as in:
  672.  
  673.   Ixxx/yyy
  674.  
  675. where the letter "I" (for ISO) is followed by a pair of ISO registration
  676. numbers for the character set, xxx for the "left half" and yyy for the right,
  677. expressed in decimal ASCII digits, for example:
  678.  
  679.   +---+---+---+--------+
  680.   | * | ' | C | I6/100 |
  681.   +---+---+---+--------+
  682.  
  683. where "*" is code for the Encoding Attribute (or transfer syntax), "'" is the
  684. length (ASCII 39 - 32 = 7) of its value, and the single character "C" is the
  685. value itself, which means "I'm using the specified Character set" specified by
  686. the six characters "I6/100" mean "ISO registration number 6", i.e. US ASCII,
  687. in the left half, and ISO registration number 100, which is the right half of
  688. Latin-1, in the right.  The "I" stands for ISO, and is included to allow for
  689. the possibility of other character set registration authorities.  Designators
  690. for each character set are given in Table 2, labeled "Kermit Designator".
  691.  
  692. For self-contained ISO standard multibyte character sets, the Kermit
  693. Designator starts with the letter "M", rather than "I", to indicate (a) that
  694. it is a multibyte, rather than single-byte, set and (b) that there is no "left
  695. half", i.e. "M" is always followed by a single ISO registration number.
  696.  
  697. In the event that a character set standard changes, but keeps the same
  698. registration number, the registration number for the new character set should
  699. be preceded by a non-numeric character which indicates the revision number: @
  700. (atsign) = 1, A=2, B=3, and so on (as suggested in ISO 2022).  For example
  701. "I@2/B100" would indicate an 8-bit single-byte character set having Revision
  702. 1 of ASCII as its left half and Revision 3 of Latin-1 as its right.  Note:
  703. "Revision 1" does not mean the original version, but rather the first
  704. revision AFTER the original version.  The Kermit designator for an original
  705. version does not have a revision indicator.
  706.  
  707. The form of the character-set designator was chosen because the standards
  708. currently provide no single code to designate an 8-bit character set in its
  709. entirety.  Each half of the character set has its own registration number.
  710. For example, ISO 8859-1 (Latin-1) is a single 8-bit character set, but
  711. registration number 100 only refers to its right half.  Registration number 6
  712. denotes ASCII, which is used as the left half of all ISO 8859 character sets.
  713.  
  714. To promote maximum interoperability among extended Kermit programs, the
  715. Kermit designator should be treated as a character string, to be looked up in
  716. a small table, rather than as a flexible mechanism to be used for piecing
  717. together character sets from an arbitrary assortment of left and right
  718. halves.  However, the Ixxx/yyy notation leaves open this possibility should
  719. it become desirable at a later time.
  720.  
  721. In the event that a new class of registration numbers appears, for example, to
  722. denote a single-byte 8-bit character set in its entirety rather than just its
  723. left or right half, a different initial letter will be used in the designator,
  724. even if the registration authority is the ISO.  In the event that other
  725. character-set registration authorities appear, they too can be assigned their
  726. own unique Kermit designator prefixes (for example, "K" for Kermit Development
  727. and Distribution), to avoid ambiguity from conflict of registration numbers.
  728. For the present, standards organizations like ANSI and CCITT are not treated
  729. as separate registration authorities, because their character sets are also
  730. registered by the ISO.  Should these organizations adopt character sets that
  731. have no ISO counterpart, then special Kermit designator prefixes will be
  732. assigned for them.
  733.  
  734. Based on the attribute information, the receiver may accept or reject the
  735. file, using Kermit's normal attribute response mechanism.  To accept, it puts
  736. a "Y" as the first character of the data field of the acknowledgement to the
  737. attribute packet.  To refuse, it puts an "N" instead of a "Y", followed by
  738. "*".  If the file is refused in this manner, the sending Kermit should respond
  739. by sending a "Z" (end-of-file) packet containing a "D" (for Discard) in its
  740. data field.
  741.  
  742. The behavior of the receiving Kermit program when an unknown character set
  743. is announced to it is governed by the command SET UNKNOWN-CHARACTER-SET.
  744. SET UNKNOWN-CHARACTER-SET KEEP means that it should not reject the file, but
  745. store it the best way it can (e.g. without translating any characters),
  746. DISCARD means that the file should be rejected.
  747.  
  748. It is recognized that there are presently Kermit implementations in the USSR,
  749. Japan, and elsewhere that use character sets other than the ones listed in
  750. Table 2 in their transfer syntax, and/or sets that are not listed in the
  751. International Register.  It is recommended that these Kermit programs be
  752. converted to use the recommended standard character sets, or if there is a
  753. strong reason why this cannot be done, that these character sets be registered
  754. with Kermit Development and Distribution at Columbia University.
  755.  
  756. LEVEL 1 PERFORMANCE
  757.  
  758. Level 1 can be used to transfer files containing special characters when
  759. character-set switching is not required.  However, Level-1 transfer will not
  760. always be efficient.  Since the special characters have their 8th bits set to
  761. one, there will be a lot of 8th-bit prefixing in the 7-bit environment -- the
  762. higher the proportion of special characters to ASCII characters, the lower the
  763. efficiency.  For a language like Russian, in which all letters come from the
  764. right half of the character set, efficiency will be poor in the 7-bit
  765. environment.
  766.  
  767. Therefore, even though Russian (and Greek, Hebrew, and Arabic) are served by
  768. Level 1 of this proposal, files encoded in these character sets can be
  769. transferred more efficiently using the facilities of Level 2 in the 7-bit
  770. communication environment.  See Table 4.
  771.  
  772. In the future, a separate proposal will address this problem in a general
  773. way, independent of transfer syntax, by specifying a locking shift mechanism
  774. to be used in Kermit's packet encoding.
  775.  
  776. EXPANDED SYNTAX, LEVEL 2: MULTIPLE CHARACTER SETS
  777.  
  778.   DO NOT PAY MUCH ATTENTION TO THIS SECTION.  IT WILL PROBABLY NEVER BE
  779.   IMPLEMENTED IN ITS PRESENT FORM BECAUSE COMPUTER FILE SYSTEMS SIMPLY DO NOT
  780.   EXIST THAT ALLOW MIXTURES OF CHARACTER SETS WITHIN A SINGLE FLAT FILE.  IN
  781.   ANY CASE, THE EMERGING ISO-10646 AND UNICODE STANDARDS MAY RENDER THIS
  782.   DISCUSSION OBSOLETE ANYWAY.
  783.  
  784. Suppose there is a computer that can store a file containing characters from
  785. many languages.  It may do this by using a multibyte character code, or by
  786. imbedding some kind of control information in the file to mark each change of
  787. character set.
  788.  
  789. One such computer is the Xerox Star and its successors, described by Joseph D.
  790. Becker in the Scientific American articles "Multilingual Word Processing"
  791. (July 1984) and "Arabic Word Processing" (July 1987).  The Star stores textual
  792. data intermixed with special codes.  A byte of all 1's means "alphabet shift",
  793. followed by another byte or two to identify the alphabet.
  794.  
  795. Another, more limited, example is a computer using one of the AT&T Extended
  796. UNIX Codes (EUC), such as JAE for Japan.  In this code, a byte with its high
  797. order bit set to zero is ASCII.  If it is set to one, then it is either a
  798. 1-byte Kanji or 1-byte Katakana character, or (if it has a certain special
  799. value) a shift character indicating that the next two bytes are a Kanji
  800. character.  (See N. Takahashi and W. Krone, "The Language Problem", UNIX
  801. Review, February 1987.)
  802.  
  803. A third example is an IBM PC or PS/2 running a commercial word processor which
  804. uses the PC's graphics adapter to display characters from different alphabets
  805. (Roman, Greek, etc) in different renditions (bold, italic, underlined).  A
  806. multilanguage word processor file may contain not only alphabet information,
  807. but also formatting and rendition information.  The format of these word
  808. processor files is proprietary, and differs from product to product.
  809.  
  810. A final example is a simple IBM PC "8-bit ASCII" text file which also
  811. contains the PC's line-drawing characters.  These characters have no
  812. equivalents in the ISO Latin alphabets, and so at least two standard
  813. character sets would be required to represent these files during
  814. transmission.
  815.  
  816. Now suppose we want to transfer a multi-language text file from one computer
  817. to a different kind of computer.  Since there will be a growing need to do
  818. this, and a growing number of computers and applications that will support
  819. multi-language text in incompatible ways, it is clearly impractical to require
  820. each computer to know the formats and codes of each other computer.
  821.  
  822. Once again, a standard common intermediate representation, or transfer syntax,
  823. is required so that each Kermit program need only know the codes and formats
  824. used on its own computer, plus the transfer syntax.  But unlike Kermit's
  825. normal transfer syntax, and unlike Kermit's Level-1 extended transfer syntax,
  826. the multi-language syntax must embody an in-band mechanism for identifying
  827. character sets and switching among them.
  828.  
  829. Fortunately, these mechanisms are already well-defined in the host-terminal
  830. communications environment, and they can be readily adapted to Kermit file
  831. transfer.  The mechanisms proposed are defined in the following international
  832. standards:
  833.  
  834.   ISO 4873, "Information Processing - ISO 8-bit code for information
  835.     interchange - Structure and rules for implementation"
  836.  
  837.   ISO 2022, "Information Processing - ISO 7-bit and 8-bit coded character 
  838.     sets - Code extension techniques"
  839.  
  840.   ISO 2375, "Data Processing - Procedure for registration of Escape Sequences"
  841.  
  842.   ISO "International Register of coded Character Sets to be Used with Escape
  843.     Sequences"
  844.  
  845. These standards are summarized in Appendix B, "How the Standards Work".  The
  846. following discussion assumes familiarity with these standards, so consult the
  847. appendix if necessary.
  848.  
  849.  
  850. KERMIT MULTI-CHARACTER-SET FILE TRANSFER
  851.  
  852. Level 2 Kermit syntax is intended for transferring multilanguage files that
  853. cannot be adequately represented in a single standard character set.  The new
  854. "international" transfer syntax preannounces character sets by their ISO
  855. registration numbers, designates them by their registered escape sequences,
  856. and invokes them by single or locking shifts as defined in ISO Standard 2022.
  857.  
  858. ENABLING LEVEL-2 TRANSFER SYNTAX
  859.  
  860. Level-2 transfer syntax is selected when the user issues the command SET
  861. TRANSFER INTERNATIONAL.  The user may return to Levels 0 or 1 using the SET
  862. TRANSFER CHARACTER-SET command, or SET TRANSFER NORMAL (See Appendix F).
  863.  
  864. PROTOCOL PRIOR TO DATA TRANSFER
  865.  
  866. It is strongly recommended that any Kermit program which is to use
  867. international syntax also support file attribute (A) packets.  These are used
  868. for two purposes: (1) to inform the receiver that international syntax will
  869. be used and with which ISO-2022 facilities, and (2) to preannounce the file's
  870. character sets.  This will give the receiver the opportunity to refuse files
  871. that it cannot translate, and to allocate the necessary resources for those
  872. files which it can accept.
  873.  
  874. In Level 2, the value of the encoding attribute "*" should be the uppercase
  875. letter "I" (for International), optionally followed by one or more ISO-2022
  876. announcer letters (the letter after <ESC><SP>), as listed in Appendix B, for
  877. example "IBZ" to declare that G0 and G1 will be used with locking shifts, and
  878. G2 with single shifts.
  879.  
  880.   +---+---+-----+
  881.   | * | # | IBZ |
  882.   +---+---+-----+
  883.  
  884. In addition, the sender may (but is not required to) preannounce the transfer
  885. syntax character sets by listing them in the new attribute, "2", "Character
  886. Sets".  The value of the character-sets attribute is a comma-separated list of
  887. Kermit character set designators.  For example:
  888.  
  889.   +---+---+----------------------+
  890.   | 2 | 4 | I2/100,I2/127,I2/144 |
  891.   +---+---+----------------------+
  892.  
  893. where "2" is the character-set attribute, "4" is the length of the following
  894. value (in this case "4" = ASCII 52 - 32 = 20) and the next 20 bytes list ISO
  895. character sets numbers 100, 127, and 144, each number prefixed by "I" to
  896. denote the ISO registration authority, and "2/" to indicate that the left half
  897. of the character set is ASCII.
  898.  
  899. If the sending Kermit can ascertain a file's character sets easily, it should
  900. send this information in the attribute packet.  Otherwise preannouncement of
  901. character sets could require a time-consuming scan through the file prior to
  902. sending, which is undesirable for large files not only because it reduces
  903. Kermit's efficiency, but also because it could cause the entire Kermit session
  904. to time out.  Therefore, preannouncement of character sets is not required.
  905.  
  906. The receiver may accept or refuse a file using Kermit's normal attribute reply
  907. mechanism.  When accepting the file, it should include, at minimum, the "*"
  908. attribute its acceptance, so that the sender will know that the receiver
  909. understands international syntax.  When refusing a file, it should indicate
  910. what caused the problem: "*" means it can't do international transfer syntax,
  911. but "2" (without "*") means that one or more of the announced character sets
  912. are unknown.
  913.  
  914. If the file is refused in this manner, the sending Kermit can issue an
  915. informative message to the user, and the user can find some other way to
  916. transfer the file (for example, binary mode, or normal text mode with pre- and
  917. postprocessing, or even by loading a new translation table).
  918.  
  919. DATA TRANSFER PROTOCOL
  920.  
  921. Transfer of a multi-character-set text file in international transfer syntax
  922. by Kermit is similar to transfer of a 7-bit ASCII text file, except that it
  923. may contain embedded control characters and escape sequences to identify and
  924. switch between character sets.  The file sender translates the file's
  925. characters (if necessary) into one or more registered alphabets, imbedding
  926. character-set designation and shifting codes in the data stream, and
  927. terminates lines of text (records) with CRLF as in ASCII text mode.  The file
  928. receiver translates from international transfer syntax into the format
  929. demanded by the local system or application.  All of this occurs before Kermit
  930. packet encoding by the sender, and after Kermit packet decoding by the
  931. receiver.
  932.  
  933. ISO 2022 states that "at the beginning of information interchange, except
  934. where the interchanging parties have agreed otherwise, all designations shall
  935. be defined by use of the appropriate escape sequences, and the shift status
  936. shall be defined by the use of the appropriate locking-shift functions."
  937. Kermit programs should "agree otherwise" that the default G0 character set is
  938. the US-ASCII/ISO-646-IRV (International Reference Version) 7-bit character
  939. set; thus international transfer syntax can be identical to Normal Kermit
  940. transfer syntax when transferring 7-bit text files.  There are no defaults for
  941. G1, G2, or G3, in the interest of fairness to all countries and peoples.
  942.  
  943. When the text contains characters outside the ASCII range, an escape sequence
  944. from Table 5 must be issued, designating the alphabet to which they belong
  945. (using the identification letters shown in Table 5) to the desired
  946. intermediate character set G0, G1, G2, or G3.  This sequence must be given
  947. before the first occurrence of a character in that alphabet.  If no such
  948. sequence is given, then the receiver treats all characters as ASCII data,
  949. including <ESC>, the shift characters, and bytes with their 8th bits set to
  950. one.  In other words, the file transfer behaves in the normal Kermit fashion
  951. for text files.
  952.  
  953. Since ISO 8859 character sets are subject to revision from time to time, an
  954. alphabet selector may be preceded by <ESC>&F, where F is the revision number
  955. (@ = 1, A = 2, B = 3, etc).  For example, <ESC>&@<ESC>-A means Latin Alphabet
  956. Number One, Revision One.  (This information is from ISO 2022 6.3.13.)
  957.  
  958. ISO 2022 escape sequences are inserted into the data, and are
  959. indistinguishable by the Kermit packet encoder/decoder from the data itself.
  960. Therefore these escape sequences may be broken across packets, just as any
  961. other data may be.
  962.  
  963. UNKNOWN ALPHABETS
  964.  
  965. It is not required that the sender preannounce all of a file's character sets
  966. prior to transfer.  Suppose a file contains a mixture of alphabets, some known
  967. to the receiver, others not.  At some point, an alphabet designator arrives
  968. which the receiving Kermit does not recognize.  Should the receiving Kermit
  969. cancel the file transfer, or accept the unknown code?  A new command is
  970. provided to let the user control what happens in this situation:
  971.  
  972.   SET UNKNOWN-ALPHABET {KEEP, CANCEL}.
  973.  
  974. If the user elects CANCEL, then the receiver will behave as if the user
  975. had manually cancelled the file, i.e. it will put the character "X" in the
  976. data field of its next acknowledgement, and the sender (assuming it supports
  977. this feature) will stop sending the file.
  978.  
  979. If the user elects KEEP, the file will be accepted in its entirety.  But the
  980. unknown code should be marked in case the user wants to fix it afterwards.  To
  981. do this, receiving program accepts the designator for the unknown alphabet and
  982. stores it in the file as data, with subsequent characters stored untranslated.
  983. When the unknown character set is shifted out of (or the end of file arrives),
  984. the receiving Kermit stores the ISO-2022 Coding Method Delimiter, <ESC>d, and
  985. resumes translation.  If the unknown alphabet is shifted back into, the
  986. designating escape sequence is stored again, and the process resumes.
  987.  
  988. A list of the designators of the unknown alphabets should be recorded in the
  989. transaction log (if there is one), for later reference.
  990.  
  991. The default behavior should be "KEEP".  This command should also be effective
  992. at Level 1, where it would simply prevent the receiving Kermit from refusing
  993. a file on the basis of the character set used to transfer it.
  994.  
  995. LOCAL FILE REPRESENTATION
  996.  
  997. This proposal assumes nothing about the representation of the file on the
  998. local storage medium.  It may be ASCII, EBCDIC, a proprietary word processor
  999. format, IBM code page, or anything else.  It is an implementation "detail" for
  1000. Kermit programmer to convert between the local file representation for
  1001. multi-alphabet text files, and Kermit's file transfer syntax.
  1002.  
  1003. In some cases, the file itself (or its directory entry) might contain the
  1004. necessary identifying information, in which case the sending Kermit program
  1005. can automatically emit the appropriate escape sequences during file transfer.
  1006. In others, the user will have to tell the sending program how the file is
  1007. encoded.  The suggested command is:
  1008.  
  1009.   SET FILE TYPE <xxx>
  1010.  
  1011. where <xxx> specifies how the file is (or when receiving, is to be) encoded on
  1012. disk.  This will necessarily be highly dependent on the system's conventions,
  1013. or the conventions of the applications to be used with the file (e.g. a
  1014. multi-language word processing program).  Possibilities for <xxx> might
  1015. include application names like WORDPERFECT, XYWRITE, NOTA-BENE, MACWRITE,
  1016. ALEPH-BET, PC-HANGUL.
  1017.  
  1018. BREAKING THE RULES
  1019.  
  1020. If the local file is not encoded according to ISO 2022 rules, it may contain
  1021. <ESC>, <SO>, and <SI> characters.  It is up to the Kermit program to know
  1022. what these characters mean in the context of the file's format, and to either
  1023. strip them from the file or translate them to something else.  The ISO 2022
  1024. rules forbid the use of these characters as data to be transferred.
  1025.  
  1026. If a file is to be transferred using international syntax, and it contains
  1027. any of the control characters significant to this syntax, namely <ESC>, <SI>,
  1028. <SO>, <SS2>, or <SS3>, then such characters should be prefixed during
  1029. transmission with Datalink Escape, <DLE>, C0 character 01/00 (Control-P).
  1030. Furthermore, if <DLE> itself occurs in the data, it should also be prefixed
  1031. with <DLE>.
  1032.  
  1033. All shifting and escape characters are subject to normal Kermit encoding
  1034. rules.  Therefore, if a file contains an <SO> character, it must be sent as
  1035. <control-prefix><P><control-prefix><N>, normally "#P#N".  If it contains an
  1036. <SS2>, and it is to be transmitted in the 7-bit environment, the encoding will
  1037. be:
  1038.  
  1039.   <control-prefix><P><8th-bit-prefix><control-prefix><N>
  1040.  
  1041. (normally "#P&#N") -- That is, five characters to transmit one!
  1042.  
  1043. Also note that a file containing data that happens to correspond to a
  1044. character-set designator (e.g. "<ESC>-X") could confound later efforts at
  1045. reconstruction when SET UNKNOWN-ALPHABET KEEP is in effect.  In this
  1046. circumstance, this character sequence can be distinguished from genuine
  1047. alphabet designators that were inserted into the file by the SET
  1048. UNKNOWN-ALPHABET KEEP feature in one of two ways: (1) by lacking a matching
  1049. <ESC>d (coding method delimiter), or (2) by not being listed in the Kermit
  1050. transaction log.
  1051.  
  1052. LEVEL-2 PERFORMANCE
  1053.  
  1054. Kermit programs may use the full range of ISO 2022 code extension techniques,
  1055. including use of G0, G1, G2, and G3 in both the 7-bit and 8-bit environments,
  1056. with both single-byte and multibyte character sets.  In the general case, G0
  1057. will be used for ASCII and English, G1 for the special characters of the
  1058. "native language" of the local country or region, G2 for a third language, and
  1059. G3 for a fourth.  Additional character sets may be swapped in and out of G2
  1060. and G3 as required.
  1061.  
  1062. Transmission of 8-bit data in the 7-bit environment is accomplished by Kermit
  1063. using 8th-bit prefixing, which is an optional feature of the Kermit protocol.
  1064. However, most popular implementations of Kermit do include this feature.  If a
  1065. Kermit program cannot do 8th-bit prefixing, then it must operate in the ISO
  1066. 2022 7-bit environment, shifting GL among the intermediate graphics sets
  1067. G0-G3.
  1068.  
  1069. If the Kermit program can do 8th-bit prefixing, the choice of the ISO 2022
  1070. 7-bit or 8-bit environment is entirely independent of the communication
  1071. channel.  Selection of the ISO 2022 7-bit or 8-bit environment should be made
  1072. on other grounds, such as transmission efficiency or program simplicity.  For
  1073. example, if the ISO 2022 8-bit environment is used on a 7-bit channel, then
  1074. Kermit will have to do 8th-bit prefixing.
  1075.  
  1076. On a 7-bit communication channel, the best choice of ISO 7-bit or 8-bit
  1077. environment depends on the nature of the data to be transferred.  If there is
  1078. little or no 8-bit data (as in English text), it doesn't matter.  If there is
  1079. frequent shifting between 7-bit and 8-bit characters (as in French or
  1080. Portuguese), then single shifts would tend to be more efficient than locking
  1081. shifts, and Kermit's 8th-bit prefixing is equivalent to a single shift.
  1082. Therefore, use the ISO 8-bit environment and let Kermit do the prefixing.  If
  1083. there are long strings of 8-bit characters, as in "right-sided" languages
  1084. like Russian, Greek, Arabic, and Hebrew, then locking shifts are more
  1085. efficient -- use the ISO 7-bit environment.
  1086.  
  1087. In Japan, many computer systems use at least three character sets, Roman
  1088. (close to ASCII), Katakana (a 1-byte code), and Kanji (a 2-byte code).  Kanji
  1089. is specified in JIS X 0208, which also includes Roman, Hiragana, Katakana, and
  1090. some other character sets, but these are double width and not normally used.
  1091. Roman characters are usually taken from the left half of JIS X 0201, and
  1092. Katakana from the right half.  Japanese text frequently shifts between Roman,
  1093. Kana, and Kanji, and therefore requires three active character sets, for
  1094. example G0 (Roman), G1 (Kana), and G2 or G3 (Kanji).  In the 8-bit
  1095. environment, data transfer can be quite efficient: locking shifts are used to
  1096. shift GL between Roman and Kana, and any bytes with the 8th bit set to one
  1097. automatically invoke Kanji in GR as a multi-byte character set.  In the 7-bit
  1098. environment, locking shifts would also be used to select Kanji.  Note that
  1099. locking shifts are more efficient in this case than Kermit 8th-bit prefixing
  1100. because Kanji characters consist of more than one byte, and tend to occur in
  1101. runs.  For Japanese, therefore, it is better to use the ISO 7-bit environment
  1102. on a 7-bit communication channel.
  1103.  
  1104. The situation is summarized in Table 4.
  1105.  
  1106. _____________________________________________________________________________
  1107.  
  1108.                             ISO 2022 Environment
  1109.                      7-bit                       8-bit
  1110.        +------------------------------+-----------------------------+
  1111.        | Recommended for right-       | Recommended for 2-sided     |
  1112.  7-bit | sided languages like Greek,  | languages like French,      |
  1113.   data | Russian, Arabic, Hebrew.     | German, etc.  Use Kermit's  |
  1114.   path | Use ISO 2022 locking shifts. | 8th-bit prefix for special  |
  1115.        | Also for Japanese.           | characters.                 |
  1116.        +------------------------------+-----------------------------+
  1117.        | No reason to use ISO 7-bit   | Clear transmission of 8-bit |
  1118.  8-bit | environment on a clear 8-bit | characters.  Use for both   |
  1119.   data | communication channel.       | left- and right-sided       |
  1120.   path | OK for 7-bit ASCII, though.  | languages, and Japanese.    |
  1121.        |                              |                             |
  1122.        +------------------------------+-----------------------------+
  1123.  
  1124.           Table 4: Selecting ISO 7- vs 8-Bit Environment
  1125. _____________________________________________________________________________
  1126.  
  1127. The user should have control over whether the ISO-2022 7-bit or 8-bit
  1128. environment is used.  To allow this, the command SET TRANSFER
  1129. INTERNATIONAL may be extended as follows:
  1130.  
  1131.   SET TRANSFER INTERNATIONAL [ {7, 8} ]
  1132.  
  1133. which means that an optional final field may be included to specify the
  1134. 7- or 8-bit ISO-2022 environment.  The default should be 8, since it is the
  1135. most efficient method in most cases.
  1136.  
  1137. If Kermit -- at all levels -- offered locking shifts in addition to single
  1138. shifts, then international syntax could always proceed in the 8-bit
  1139. environment, and this would simplify implementation considerably.  A proposal
  1140. on locking shifts for Kermit is forthcoming.
  1141.  
  1142. FILE TRANSFER SYNTAX EXAMPLES
  1143.  
  1144. A simple 7-bit ASCII text file can be transmitted in the normal Kermit manner
  1145. for text files, without any escapes or shifts, even in international syntax.
  1146.  
  1147. A text file containing characters from a language or languages covered by a
  1148. single alphabet other than ASCII can be transferred exactly like an ASCII text
  1149. file, except that the attribute, if used, would denote the character set, e.g.
  1150. "*!C2&I2/100" for Latin-1.  In the 7-bit environment, international syntax can
  1151. be used to cut down on Kermit's 8th-bit prefixing overhead, in which case the
  1152. attributes might look like "*#IBJ2&2/144", and any strings of GR characters
  1153. would be preceded by LS1 and transmitted with their high-order bits set to
  1154. zero.
  1155.  
  1156. A multi-character-set text file will require an escape sequence to identify
  1157. each alphabet.  The attribute packet would show international encoding,
  1158. optionally including the ISO 2022 facilities announcers, and the character
  1159. sets, as in "*#ICK2-I2/100,I2/144".
  1160.  
  1161. In the 7-bit environment, <SO> and <SI> are used to shift between the G0 and
  1162. G1 sets.  In the absence of any specific designators, the G0 set is presumed
  1163. to be ASCII.  Example:
  1164.  
  1165.   A dangerous German word is "gef<ESC>-A<SO>d<SI>hrlich".
  1166.  
  1167. In this case, the only extended character is the umlaut-a in "gefaehrlich"
  1168. (where ae is how to write umlaut-a without an umlaut).  <ESC>-A designates
  1169. Latin-1 into G1, <SO> shifts GL out to G1, "d" is the left-half equivalent
  1170. of umlaut-a, and <SI> shifts GL back in to G0.
  1171.  
  1172. For clarity and consistency with the ISO-2022 recommendations, it is
  1173. recommended that the text begin with explicit character set designations, and
  1174. then explicitly shift into the G0 set, rather than defaulting to it:
  1175.  
  1176.   <ESC>(B<ESC>-A<SI>A dangerous German word is "gef<SO>d<SI>hrlich".
  1177.  
  1178. A text file containing characters from multiple ISO 8859 alphabets requires a
  1179. designation sequence for each alphabet.  In the 7-bit environment, SO and SI
  1180. can be used to shift between G0 and G1 of the current alphabet, and <ESC>(B
  1181. can be used to select G0 of any of the alphabets, since these are all the
  1182. same.  For example, the following text contains the same word in English,
  1183. French, and Russian:
  1184.  
  1185.   <ESC>-A<SI>Disappointed, d<SO>ig<SI>u, <ESC>-L<SO>`PW^gP`^RP]]kY<SI>.
  1186.  
  1187. The first escape sequence assigns Latin Alphabet No. 1 to G1, and the
  1188. subsequent <SO> and <SI> shifts apply to its G0 and G1 set, which is used to
  1189. form the English and French words.  The second escape sequence assigns the
  1190. Latin/Cyrillic 96-character set to G1, and the subsequent shifts apply to this
  1191. new set.
  1192.  
  1193. Another 7-bit example, in which the same word is repeated in English,
  1194. Russian, and German, shows how a locking shift remains in effect when the
  1195. alphabet is changed.  We begin in Latin/Cyrillic, start with an English word
  1196. from G0, shift to G1 for the Russian word, and while still in G1 switch to
  1197. Latin Alphabet No. 1 for German to get the umlaut-A at the beginning of
  1198. Aenderung (where Ae = umlaut-uppercase-A), and shift back to G0 for the rest
  1199. of the word:
  1200.  
  1201.   <ESC>-LAlteration <SO>_U`UTU[ZP <ESC>-AD<SI>nderung.
  1202.  
  1203. Some rules and hints to remember:
  1204.  
  1205. 1. In the 8-bit communication environment, always use 8-bit character
  1206.    transmission -- it's more efficient.
  1207.  
  1208. 2. There can be no more than four character sets designated at one time.
  1209.    Generally designate ASCII to G0, the most frequently-used non-ASCII set
  1210.    to G2, less frequently used sets to G3 and G1.  If a file has more than 
  1211.    four sets, swap the least frequently used sets in and out of G3 and G1.
  1212.  
  1213. 3. Single shifts can only be used with G2 and G3.  This is why G2 and G3
  1214.    are preferred to G1.
  1215.  
  1216. 4. Only two character sets can be invoked at once in the 8-bit communication
  1217.    environment, and only one in the 7-bit environment.
  1218.  
  1219. SPECIAL EFFECTS
  1220.  
  1221. Today, most multi-alphabet files are produced by proprietary text processing
  1222. programs.  These programs have many functions besides switching among
  1223. alphabets.  They may also endow text with special attributes such as boldface,
  1224. italic, underline, super- or subscript, color, etc, and render characters in a
  1225. variety of type styles and sizes.  Each text processing program may have its
  1226. own unique formats and conventions.
  1227.  
  1228. These special effects are not addressed by this proposal.  Nevertheless, it is
  1229. likely that a multi-alphabet file produced by a text processing program also
  1230. contains special effects.  In order for a Kermit program to send a
  1231. multi-alphabet file, it must have detailed knowledge of the file's format and
  1232. coding conventions.  Therefore, the Kermit program should be able to strip out
  1233. the special effects, and send only the text.  Otherwise the result would be
  1234. meaningless when received on an unlike system or for use with a different
  1235. application.  (When transferring such files between like systems or compatible
  1236. applications, Kermit binary mode transfers will suffice.)
  1237.  
  1238. At some future time, it might be possible to adapt one of the popular document
  1239. description languages to the Kermit protocol, so that Kermit will be able to
  1240. transfer formatted documents between unlike systems and applications.
  1241. Presently, there are many competing would-be standards including IBM DCA and
  1242. DIA, DEC DDIF, US Navy DIF, Postscript.  There are also two ISO standards
  1243. emerging in this area: Standard Generalized Markup Language (ISO 8879, 9069,
  1244. and 9573), and Office Document Architecture (ISO 8613).  This is an area for
  1245. further study.
  1246.  
  1247.  
  1248. TERMINAL EMULATION
  1249.  
  1250. While not part of the Kermit file transfer protocol, terminal emulation is a
  1251. feature of many Kermit programs.  It is hoped that these terminal emulators
  1252. will evolve along the lines of the ISO standards mentioned above.  In some
  1253. cases, this is already a fact, insofar as DEC VT300 series terminals already
  1254. follow these standards and Kermit programs are beginning to emulate these
  1255. terminals.
  1256.  
  1257. Kermit should be as easy to use as possible, but should still give the user
  1258. the ability to specify exactly what character codes are in use for both
  1259. terminal emulation and file transfer.  There should also be a consistent set
  1260. of commands for all Kermit programs.
  1261.  
  1262.  
  1263. APPENDIX A: STANDARDS
  1264.  
  1265. ANSI X3.4 (1986), "Coded Character Sets - 7-bit American Standard Code for
  1266.   Information Interchange" (US ASCII), is the 7-bit code currently used by
  1267.   Kermit for transferring text files. 
  1268.  
  1269. ISO 646 (1983) (= ECMA-6), "Information Processing - ISO 7-bit Coded Character 
  1270.   Sets for Information Interchange", gives us a 7-bit character set equivalent
  1271.   to ASCII with provision for substituting "national characters" in selected
  1272.   positions.
  1273.  
  1274. ISO 4873 (1986) (= ECMA-43), "Information Processing - ISO 8-bit Code for
  1275.   Information Interchange - Structure and Rules for Implementation", defines
  1276.   8-bit character sets, their graphic and control regions, and how to extend
  1277.   an 8-bit character set by using multiple intermediate graphics sets.
  1278.  
  1279. ISO 2022 (1986) (= ECMA-35), "Information Processing - ISO 7-bit and 8-bit
  1280.   Coded Character Sets - Code Extension Techniques", describes how to use
  1281.   8-bit character sets in both 7-bit and 8-bit environments, and how to switch
  1282.   among different character sets and alphabets.
  1283.  
  1284. ISO International Register of Coded Character Sets to be Used with Escape
  1285.   Sequences.  This is the source of the ISO registration numbers.
  1286.  
  1287. ISO 2375 (1985) "Data Processing - Procedure for Registration of Escape
  1288.   Sequences".  The procedure by which a character set gets into the above
  1289.   register and has a registration number and designating escape sequence
  1290.   assigned to it.
  1291.  
  1292. JIS X 0202, "Code Extension Techniques for Use the Code for Information
  1293.   Interchange", the Japanese counterpart of ISO 2022.
  1294.  
  1295. ANSI X3.41-1974, "Code Extension Techniques for Use with the 7-Bit Coded
  1296.   Character Set of the American National Standard Code for Information
  1297.   Interchange", describes 7- and 8-bit codes and extension techniques in
  1298.   approximately the same manner as ISO 4873 and ISO 2022.
  1299.  
  1300. ISO 8859 (1987-present) (see Table 6 for ECMA equivalents), "Information
  1301.   Processing - 8-Bit Single-Byte Coded Graphic Character Sets", defines the
  1302.   actual 8-bit character sets to be used for many of the world's languages.
  1303.   The left half of each of these is the same as ASCII and ISO 646 IRV.  Each
  1304.   character, including those with diacritics, is represented by a single byte.
  1305.  
  1306.  
  1307. ISO is the International Standardization Organization, ANSI is the American
  1308. National Standards Institute, ECMA is the European Computer Manufacturers
  1309. Association.  JIS means Japan Industrial Standard.
  1310.  
  1311. The ISO/ECMA standards discussed in this proposal may be obtained free of
  1312. charge in their ECMA form by writing to:
  1313.  
  1314.   ECMA Headquarters
  1315.   Rue du Rhone 114
  1316.   CH-1204 Geneva
  1317.   SWITZERLAND
  1318.  
  1319. Be sure to specify the title and the ECMA number of each standard requested.
  1320.  
  1321. In general, the ISO member body from each country acts as the local sales
  1322. agent for ISO Standards in that country, for example ANSI in the USA:
  1323.  
  1324.   Sales Department
  1325.   American National Standards Institute
  1326.   1430 Broadway
  1327.   New York, NY  10018
  1328.   Telephone 212-354-3300
  1329.  
  1330. Each such organization has its own arrangements for disseminating printed
  1331. documents.  ANSI sells them for US dollars; organizations in other countries
  1332. may either sell them for local currency or give them away, depending on how
  1333. they are funded to operate.
  1334.  
  1335. ISO standards and CCITT recommendations can also be ordered from the UN
  1336. bookstore, but not free of charge:
  1337.  
  1338.   United Nations Bookstore
  1339.   United Nations Building
  1340.   New York, NY  10017
  1341.  
  1342. CCITT recommendations are also available from ANSI.
  1343.  
  1344.  
  1345.  
  1346. APPENDIX B: HOW THE STANDARDS WORK
  1347.  
  1348. ASCII and ISO 646 give us a 128-character 7-bit character set.  This set is
  1349. divided into two parts:
  1350.  
  1351.   1. 33 "control characters" (characters 0 through 31, and character 127).
  1352.   2. 95 "graphic characters" (32-126).
  1353.  
  1354. "Graphics" means printing characters -- characters that make ink appear on the
  1355. page or phosphor glow on the screen (as opposed to pixel- or line-oriented
  1356. picture graphics), plus the space character.  The ASCII / ISO-646 IRV
  1357. character set is shown in Figure 1, arranged in a table of 16 rows and 8
  1358. colums.
  1359.  
  1360. _____________________________________________________________________________
  1361.  
  1362.       00  01  02  03  04  05  06  07
  1363.      +---+---+---+---+---+---+---+---+
  1364.   00 |NUL DLE| SP  0   @   P   `   p |
  1365.   01 |SOH DC1| !   1   A   Q   a   q |
  1366.   02 |STX DC2| "   2   B   R   b   r |
  1367.   03 |ETX DC3| #   3   C   S   c   s |
  1368.   04 |EOT DC4| $   4   D   T   d   t |
  1369.   05 |ENQ NAK| %   5   E   U   e   u |
  1370.   06 |ACK SYN| &   6   F   V   f   v |
  1371.   07 |BEL ETB| '   7   G   W   g   w |
  1372.   08 |BS  CAN| (   8   H   X   h   x |
  1373.   09 |HT  EM | )   9   I   Y   i   y |
  1374.   10 |LF  SUB| *   :   J   Z   j   z |
  1375.   11 |VT  ESC| +   ;   K   [   k   { |
  1376.   12 |LF  FS | ,   <   L   \   l   | |
  1377.   13 |CR  GS | -   =   M   ]   m   } |
  1378.   14 |SO  RS | .   >   N   ^   n   ~ |
  1379.   15 |SI  US | /   ?   O   _   o  DEL|
  1380.      +---+---+---+---+---+---+---+---+
  1381.  
  1382.   Figure 1: The ASCII / ISO-646 International
  1383.      Reference Version 7-bit Character Set
  1384. _____________________________________________________________________________
  1385.  
  1386. Characters are often referred to by their column and row position in this type
  1387. of table.  For example, character 05/08 in Figure 1 is "X".  Columns 00-01,
  1388. plus character 07/15, comprise the control set.  Columns 02-07, minus
  1389. character 07/15, comprise the graphics.
  1390.  
  1391. 8-bit character sets are described in ISO 4873.  An 8-bit character set has
  1392. two sides.  Each side has a control set and a graphics set.  The "left half"
  1393. consists of the control set C0 and the graphics set GL (Graphics Left).  GL
  1394. has 94 characters, and corresponds to ASCII (and ISO 646 IRV) positions
  1395. 02/01-07/14.  SP (space) and DEL are not considered part of GL.  All the
  1396. characters in the left half have their high-order, or 8th, bit set to zero,
  1397. and are therefore representable in 7 bits.  The "right half" consists of the
  1398. control set C1 and the graphics set GR (Graphics Right).  All characters in
  1399. the right half have their 8th bits set to one.  Figure 2 shows the layout of
  1400. an 8-bit character set.
  1401.  
  1402. _____________________________________________________________________________
  1403.  
  1404.      <--C0--> <---------GL---------->  <--C1--> <---------GR---------->
  1405.        00  01  02  03  04  05  06  07    08  09  10  11  12  13  14  15
  1406.      +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
  1407.   00 |NUL DLE| SP  0   @   P   `   p | |    DCS|---+                   |
  1408.   01 |SOH DC1| !   1   A   Q   a   q | |    PU1|                       |
  1409.   02 |STX DC2| "   2   B   R   b   r | |    PU2|                       |
  1410.   03 |ETX DC3| #   3   C   S   c   s | |    STS|                       |
  1411.   04 |EOT DC4| $   4   D   T   d   t | |IND CCH|                       |
  1412.   05 |ENQ NAK| %   5   E   U   e   u | |NEL MW |                       |
  1413.   06 |ACK SYN| &   6   F   V   f   v | |SSA SPA|                       |
  1414.   07 |BEL ETB| '   7   G   W   g   w | |ESA EPA|                       |
  1415.   08 |BS  CAN| (   8   H   X   h   x | |HTS    |      (special         |
  1416.   09 |HT  EM | )   9   I   Y   i   y | |HTJ    |       graphics)       |
  1417.   10 |LF  SUB| *   :   J   Z   j   z | |VTS    |                       |
  1418.   11 |VT  ESC| +   ;   K   [   k   { | |PLD CSI|                       |
  1419.   12 |LF  FS | ,   <   L   \   l   | | |PLU ST |                       |
  1420.   13 |CR  GS | -   =   M   ]   m   } | |RI  OSC|                       |
  1421.   14 |SO  RS | .   >   N   ^   n   ~ | |SS2 PM |                       |
  1422.   15 |SI  US | /   ?   O   _   o  DEL| |SS3 APC|                   +---|
  1423.      +---+---+---+---+---+---+---+---+ +---+---+---+---+---+---+---+---+
  1424.      <--C0--> <---------GL---------->  <--C1--> <---------GR---------->
  1425.  
  1426.                       Figure 2: An 8-Bit Character Set
  1427. _____________________________________________________________________________
  1428.  
  1429. GR character sets can have either 94 or 96 characters.  A 94-character GR set
  1430. begins in position 10/01 and ends in position 15/14, with Space (SP) occupying
  1431. position 10/00 and DEL in position 15/15, just like GL (the corners shown in
  1432. GR in the diagram).  A 96-character set has graphic characters in all 96
  1433. positions, 10/00 through 15/15.
  1434.  
  1435. An 8-bit alphabet, therefore, has up to 94 + 96 = 190 graphic characters.
  1436. This number is sufficient to represent the characters in many of the world's
  1437. written languages, but not necessarily sufficient to represent all the graphic
  1438. symbols required in a given application, for instance a multi-language
  1439. document.
  1440.  
  1441. To represent a greater number of graphic characters, ISO 4873 defines four
  1442. "intermediate sets" of graphic characters, of either 94 or 96 characters each.
  1443. These are called G0, G1, G2, and G3.  The G0 set never has more than 94
  1444. graphic characters, and G1-G3 can have up to 96 each.  Therefore there can be
  1445. up to:
  1446.  
  1447.   94 + (3 x 96) = 382
  1448.  
  1449. graphics characters simultaneously within the repertoire of a given device.
  1450.  
  1451. These intermediate graphics sets are kept in tables in the memory of the
  1452. terminal or computer.  One of the intermediate sets (usually G0) is assigned
  1453. to GL, and (in the 8-bit communications environment) another may be assigned
  1454. to GR.  When the terminal or computer receives a data byte, the numeric value
  1455. of its bits denotes the position of the character in GL or GR.  For example,
  1456. the byte 01000001 binary = 65 decimal = 04/01 = uppercase A in ASCII.  In the
  1457. 8-bit environment, any byte with its 8th bit set to zero is from GL, and a
  1458. byte with its 8th bit set to one is from GR.
  1459.  
  1460. A language like English can be represented adequately by ASCII in GL, because
  1461. all the required characters fit there.  When a language has more than 94
  1462. characters, two techniques are used to represent all the characters:
  1463.  
  1464.   1. For alphabetic languages, put ASCII (or the ISO-646 IRV) in GL and
  1465.      the special characters (like accented letters) in GR.  French, German,
  1466.      and Russian are examples.
  1467.  
  1468.   2. For languages with many symbols (e.g. where a symbol is assigned
  1469.      to each word, rather than to each sound), represent each character
  1470.      with multiple bytes rather than one byte.  Japanese Kanji, for example,
  1471.      uses a 2-byte code.  A multibyte code may be assigned to G0, G1, G2, or
  1472.      G3, just like a single-byte code. 
  1473.  
  1474. How do we assign actual character sets to G0-G3, and how do we associate the
  1475. intermediate character sets with the active character set?
  1476.  
  1477. Selection of character sets is accomplished using special control characters
  1478. and escape sequences embedded within the data stream as described in ISO
  1479. Standard 2022.  An ESCAPE SEQUENCE is used to DESIGNATE a particular alphabet
  1480. (such as Roman, Cyrillic, Hebrew, Arabic, Kanji, etc) to a particular
  1481. intermediate graphics set (G0, G1, G2, or G3).  A SHIFT FUNCTION is used to
  1482. INVOKE a particular intermediate graphics set into GL or GR.  In programmer's
  1483. terms, GL and GR are pointers into the array of tables G0..G3, and the shift
  1484. functions simply change the values of these pointers.
  1485.  
  1486. In our discussion, we use the following notation (numbers are decimal unless
  1487. otherwise noted):
  1488.  
  1489.   <ESC> Escape (ASCII 27, character 01/11)
  1490.   <SP>  Space  (ASCII 32, character 02/00)
  1491.   <SO>  Shift Out (Ctrl-N, ASCII 14, character 00/14)
  1492.   <SI>  Shift In  (Ctrl-O, ASCII 15, character 00/15)
  1493.  
  1494. Table 5 shows the alphabet designatation functions for single-byte and
  1495. multi-byte character sets in both the 7-bit and 8-bit environments.  The
  1496. character which is substituted for "F" identifies the actual character set to
  1497. be used.
  1498.  
  1499. _____________________________________________________________________________
  1500.  
  1501.   Escape            
  1502.  Sequence     Function                                         Invoked By
  1503.  
  1504.   <ESC>(F     assigns 94-character graphics set "F" to G0.     SI or LS0
  1505.   <ESC>)F     assigns 94-character graphics set "F" to G1.     SO or LS1
  1506.   <ESC>*F     assigns 94-character graphics set "F" to G2.     SS2 or LS2
  1507.   <ESC>+F     assigns 94-character graphics set "F" to G3.     SS3 or LS3
  1508.   <ESC>-F     assigns 96-character graphics set "F" to G1.     SO or LS1
  1509.   <ESC>.F     assigns 96-character graphics set "F" to G2.     SS2 or LS2
  1510.   <ESC>/F     assigns 96-character graphics set "F" to G3.     SS3 or LS3
  1511.   <ESC>$(F    assigns multibyte character set "F" to G0.       SI or LS0
  1512.   <ESC>$)F    assigns multibyte character set "F" to G1.       SO or LS1
  1513.   <ESC>$*F    assigns multibyte character set "F" to G2.       SS2 or LS2
  1514.   <ESC>$+F    assigns multibyte character set "F" to G3.       SS3 or LS3
  1515.  
  1516.              Table 5: Escape Sequences for Alphabet Designation
  1517. _____________________________________________________________________________
  1518.  
  1519. Table 6 shows the escape sequences used to designate the appropriate parts of
  1520. each of the registered character sets discussed in this proposal to G1 (except
  1521. that ASCII is designated to G0, which is the normal situation).  It is
  1522. important to note that the final letter of the escape sequence is not always
  1523. sufficient to designate a character set.  For example, Czech Standard and JIS
  1524. Katakana are both designated by letter I.  But the two can be distinguished by
  1525. the intermediate characters of the escape sequence, which specify whether the
  1526. set is single- or multibyte, or, when both sets are single-byte, whether there
  1527. are 94 or 96 characters.
  1528.  
  1529. _____________________________________________________________________________
  1530.  
  1531.                             Escape    ISO          ECMA        ISO/ECMA
  1532.  Alphabet Name              Sequence  Reference    Reference   Registration
  1533.  
  1534.   ASCII (ANSI X3.4-1986)    <ESC>(B   ISO 646 IRV  ECMA-6        2
  1535.   Latin Alphabet No. 1      <ESC>-A   ISO 8859-1   ECMA-94     100
  1536.   Latin Alphabet No. 2      <ESC>-B   ISO 8859-2   ECMA-94     101
  1537.   Latin Alphabet No. 3      <ESC>-C   ISO 8859-3   ECMA-94     109
  1538.   Latin Alphabet No. 4      <ESC>-D   ISO 8859-4   ECMA-94     110
  1539.   Latin/Cyrillic            <ESC>-L   ISO 8859-5   ECMA-113    144
  1540.   Latin/Arabic              <ESC>-G   ISO 8859-6   ECMA-114    127
  1541.   Latin/Greek               <ESC>-F   ISO 8859-7   ECMA-118    126
  1542.   Latin/Hebrew              <ESC>-H   ISO 8859-8   ECMA-121    138
  1543.   Latin Alphabet No. 5      <ESC>-M   ISO 8859-9   ECMA-128    148
  1544.   Czech Standard CSN 369 03 <ESC>-I   none         none        139
  1545. * Math/Technical Set        <ESC>-K   ????         ????        143
  1546.   Chinese (CAS GB 2312-80)  <ESC>$)A  none         none         58
  1547.   Japanese (JIS X 0208)     <ESC>$)B  none         none         87
  1548.   JIS-Katakana (JIS X 0201) <ESC>)I   none         none         13
  1549.   JIS-Roman (JIS X 0201)    <ESC>)J   none         none         14
  1550.   Korean (KS C 5601-1987)   <ESC>$)C  none         none        149
  1551.  
  1552.    Table 6: Alphabets, Selectors, Standards, and Registration Numbers
  1553. _____________________________________________________________________________
  1554.  
  1555. * A math/technical set is clearly needed to handle the IBM PC, DEC VT-series,
  1556.   and other math/technical/line-drawing characters, but there is apparently no
  1557.   such standard set at this time.
  1558.  
  1559. Tables 7 and 8 show the shift functions that are used to invoke the
  1560. intermediate character sets.  These shift functions may be either locking or
  1561. single.  "Locking shift" is like shift-lock on a typewriter.  It means that
  1562. all subsequent characters until the next shift are to be taken from the
  1563. designated intermediate character set.  "Single shift" applies only to the
  1564. character (either single or multibyte) that follows it immediately, but single
  1565. shift functions are only available for the G2 and G3 sets.  Locking shift
  1566. functions remain in effect across alphabet changes.
  1567.  
  1568. In the 7-bit environment, only one character set, GL, can be active at a time.
  1569. The active character set can be selected from among the intermediate sets
  1570. G0-G3 by the shifts shown in Table 6.  Control characters from C0 are
  1571. transmitted as-is, and those from the C1 set are sent prefixed by <ESC>
  1572. followed by the character value, minus 64.  For example, the C1 character
  1573. 10000001 binary (129 decimal) becomes <ESC>A (129 - 64 = 65 = "A").
  1574.  
  1575. _____________________________________________________________________________
  1576.  
  1577.  Shift  Representation  Name              Function
  1578.  
  1579.   SI       Ctrl-O       Shift In          invoke G0 into GL
  1580.   SO       Ctrl-N       Shift Out         invoke G1 into GL
  1581.   LS2      <ESC>n       Locking Shift 2   invoke G2 into GL
  1582.   LS3      <ESC>o       Locking Shift 3   invoke G3 into GL
  1583.   SS2      <ESC>N       Single Shift 2    select single character from G2
  1584.   SS3      <ESC>O       Single Shift 3    select single character from G3
  1585.  
  1586.                Table 7: Shifts Used in the 7-Bit Environment
  1587. _____________________________________________________________________________
  1588.  
  1589. In the 8-bit environment two character sets, GL and GR, can be active at once.
  1590. A GL character is selected by a byte whose 8th bit is zero, and a GR character
  1591. by a byte whose eighth bit is one.  The actual character sets assigned to GL
  1592. and GR are selected by the shifts shown in Table 8.  Control characters from
  1593. both the C0 and C1 sets are sent as is.
  1594.  
  1595. _____________________________________________________________________________
  1596.  
  1597.  Shift  Representation  Name                   Function
  1598.  
  1599.   LS0      Ctrl-O       Locking Shift 0        invoke G0 into GL
  1600.   LS1      Ctrl-N       Locking Shift 1        invoke G1 into GL
  1601.   LS2      <ESC>n       Locking Shift 2        invoke G2 into GL
  1602.   LS3      <ESC>o       Locking Shift 3        invoke G3 into GL
  1603.   LS1R     <ESC>~       Locking Shift 1 Right  invoke G1 into GR
  1604.   LS2R     <ESC>}       Locking Shift 2 Right  invoke G2 into GR
  1605.   LS3R     <ESC>|       Locking Shift 3 Right  invoke G3 into GR
  1606.   SS2       08/14       Single Shift 2         select single character from G2
  1607.   SS3       08/15       Single Shift 3         select single character from G3
  1608.  
  1609.              Table 8: Shifts Used in the 8-Bit Environment
  1610. _____________________________________________________________________________
  1611.  
  1612. So we have a 3-tiered system.  At the bottom tier lie all the world's coded
  1613. character sets.  We can designate up to four of them, one to each of the
  1614. intermediate graphics sets G0, G1, G2, and G3 using the escape sequences shown
  1615. in Tables 5 and 6.  The terminal or computer keeps each of the selected
  1616. intermediate sets in memory.  There is also one active set, composed of GL and
  1617. GR.  The intermediate sets are invoked to GL or GR (one at a time) by the
  1618. shifts SO, SI, LS0, LS1, etc, shown in Tables 7 and 8.  A simplified diagram
  1619. for the 8-bit environment is shown in Figure 3 (see ISO 2022 for detailed
  1620. diagrams of both the 7-bit and 8-bit environments).  On a more sophisticated
  1621. output device, Figure 3 would contain numerous arrows pointing upwards to
  1622. demonstrate the operation of the designators and shifts.
  1623.  
  1624. _____________________________________________________________________________
  1625.  
  1626.                    +--+--------+  +--+--------+
  1627.                    |C0|   GL   |  |C1|   GR   |
  1628.                    |  |        |  |  |        |                  8-Bit
  1629.                    |  |        |  |  |        |                  Code
  1630.                    |  |        |  |  |        |                  In Use
  1631.                    +--+--------+  +--+--------+
  1632.                      
  1633.                    
  1634.          LS0          LS1,LS1R      LS2,LS2R      LS3,LS3R       Shifts
  1635.                                       SS2           SS3
  1636.        +--------+    +--------+    +--------+    +--------+      Intermediate
  1637.        |        |    |        |    |        |    |        |      Graphics
  1638.        |   G0   |    |   G1   |    |   G2   |    |   G3   |      Sets
  1639.        |        |    |        |    |        |    |        |
  1640.        +--------+    +--------+    +--------+    +--------+
  1641.                                                                  Alphabet
  1642.                                                                  Designation
  1643.  <ESC>(B      <ESC>-A      <ESC>-B      <ESC>-L      <ESC>$)B    Sequences
  1644.                                                     +---------+
  1645. +--------+   +--------+   +--------+   +--------+  +--------+ |  The world's
  1646. | ISO    |   | ISO    |   |  ISO   |   |  ISO   |  | JIS X  | |  registered
  1647. | 646IRV |   | Latin  |   |  Latin |   |  Latin |  | 0208   | |  character
  1648. |(ASCII) |   | 1      |   |  2     |   |Cyrillic|  | Kanji  | +  sets
  1649. +--------+   +--------+   +--------+   +--------+  +--------+
  1650.  
  1651.           Figure 3: The ISO 2022 Character Set Selection Mechanisms
  1652. _____________________________________________________________________________
  1653.  
  1654. For example, the following sequence would be used to transmit the German word
  1655. "<umlaut-u>bern<umlaut-a>chtig" using Latin Alphabet 1 in the 7-bit
  1656. environment:
  1657.  
  1658.   <ESC>(B<ESC>-A<SO>|<SI>bern<SO>d<SI>chtig
  1659.  
  1660. where:
  1661.  
  1662.   <ESC>(B   designates ASCII to G0
  1663.   <ESC>-A   designates the right half of Latin Alphabet 1 to G1
  1664.   <SO>      invokes G1 to GL
  1665.   |         is character 07/12, but since G1 is invoked to GL, it really
  1666.               denotes character 15/12, which is <umlaut-u>
  1667.   <SI>      invokes G0 to GL
  1668.   bern      are characters from G0, which is invoked in GL
  1669.   <SO>      invokes G1 to GL
  1670.   d         is character 06/04, but since G1 is invoked to GL, it really
  1671.               denotes character 14/04, which is <umlaut-a>
  1672.   <SI>      invokes G0 to GL
  1673.   chtig     are characters from G0
  1674.  
  1675. The same word could be transmitted in the 7-bit environment using single
  1676. shifts, if Latin Alphabet 1 were designated to G2 (or G3):
  1677.  
  1678.   <ESC>(B<ESC>*A<ESC>N|bern<ESC>Ndchtig
  1679.  
  1680. (where <ESC>*A designates Latin-1 to G2, and <ESC>N is Single Shift 2).
  1681.  
  1682. In the 8-bit environment it could be transmitted using no shifts at all:
  1683.  
  1684.   <ESC>(B<ESC>-A<umlaut-u>bern<umlaut-a>chtig
  1685.  
  1686. The designation escape sequences are transmitted only at the beginning of a
  1687. session and need not be repeated after the initial designations are made,
  1688. unless an intermediate set (G0-G3) is to be recycled.
  1689.  
  1690. To understand the three-tiered design of ISO 2022, imagine a computer
  1691. programmed to display a mixture of character sets on its screen.  A large
  1692. collection of fonts might be stored on the disk, one font per file.  These are
  1693. the character sets of the bottom tier.  When a font is needed, it will be read
  1694. from the disk and stored in memory in an array, for rapid access.  If several
  1695. fonts are needed, they will be stored in several arrays.  These arrays are the
  1696. intermediate character sets, G0-G3.  When a data byte arrives to be displayed,
  1697. the actual graphic representation is taken from GL or GR (depending on the
  1698. byte's 8th bit).  GL is associated with one of the intermediate graphic sets,
  1699. and GR with another.  If no more than four character sets are used, then each
  1700. one needs to be read from the disk only once, and display is rapid and
  1701. efficient thereafter.
  1702.  
  1703. ANNOUNCING ISO 2022 FACILITIES
  1704.  
  1705. A large portion of ISO 2022 is devoted to describing how 8-bit characters may
  1706. be transmitted on a 7-bit communication path, for example when parity is in
  1707. use.  In the 7-bit environment, there is only GL -- no GR.  Therefore, all
  1708. characters are transmitted with their 8th bit removed, and shifts are used to
  1709. specify which intermediate set they belong to.
  1710.  
  1711. In fact, there are many possible ways to use the ISO 2022 code extension
  1712. facilities within both 7-bit and 8-bit environments.  For example, the sender
  1713. may inform the receiver in advance whether G1, G2, or G3 will be used, etc, so
  1714. that the receiver can allocate the appropriate resources.  At the beginning of
  1715. any particular data transfer, the facilities that actually will be used can be
  1716. announced with a sequence of the form <ESC><SP>F, where F is replaced by an
  1717. ISO 2022 announcer.  Several of the most important ones are described here.
  1718. Table 9 lists all the defined announcers in summary form.  For details, see
  1719. ISO 2022.
  1720.  
  1721. <ESC><SP>A means that only the G0 set will be used, invoked into GL.  No
  1722.   shift functions will be used.  In the 8-bit environment, GR is not used.
  1723.   In other words, only a single 7-bit character set is used.
  1724.  
  1725. <ESC><SP>B means the G0 and G1 sets will be used with locking shifts.  In the
  1726.   7-bit environment <SI> invokes G0 into GL, <SO> invokes G1 into GL.  In the
  1727.   8-bit environment, LS0 invokes G0 into GL, LS1 invokes G1 into GL.  In other
  1728.   words, two character sets are used, with characters from both sets always
  1729.   sent as 7-bit values, with locking shifts used to specify the 8th bit.
  1730.  
  1731. <ESC><SP>C means that G0 and G1 will be used in the 8-bit environment, with G0
  1732.   invoked in GL and G1 in GR.  No locking shift functions are used.  In other
  1733.   words, a single 8-bit character set is used, with all 8 bits transmitted as
  1734.   data.  GL is selected when the character's 8th bit is zero, GR is selected
  1735.   when the 8th bit is one.
  1736.  
  1737. <ESC><SP>D means that G0 and G1 will be used with locking shifts.  In the
  1738.   7-bit environment, <SI> invokes G0 into GL and <SO> invokes G1 into GL.  In
  1739.   the 8-bit environment, all 8 bits of each character are transmitted with no
  1740.   shifts.
  1741.  
  1742. <ESC><SP>L means that Level 1 of ISO 4873 will be used.  That is, a single
  1743.   8-bit character set with C0, G0, C1, and G1, with no shift functions.
  1744.   This is like <ESC><SP>C.
  1745.  
  1746. <ESC><SP>M means that Level 2 of ISO 4873 will be used.  This is equivalent
  1747.   to Level 1, with the addition of G2 and G3.  Characters from G2 and G3 are
  1748.   invoked only by the single-shift functions SS2 and SS3.
  1749.  
  1750. <ESC><SP>N means that Level 3 of ISO 4873 will be used.  This is equivalent
  1751.   to Level 2 with the addition of the locking shift functions LS1R, LS2R, and
  1752.   LS3R. (Note that ISO 4873 does not concern itself with the 7-bit
  1753.   environment, and therefore does not discuss the use of LS0, LS1, LS2, or
  1754.   LS3.) 
  1755.  
  1756. _____________________________________________________________________________
  1757.  
  1758. Esc Sequence  7-Bit Environment          8-Bit Environment 
  1759.  
  1760. <ESC><SP>A    G0->GL                     G0->GL
  1761. <ESC><SP>B    G0-(SI)->GL, G1-(SO)->GL   G0-(LS0)->GL, G1-(LS1)->GL
  1762. <ESC><SP>C    (not used)                 G0->GL, G1->GR
  1763. <ESC><SP>D    G0-(SI)->GL, G1-(SO)->GL   G0->GL, G1->GR
  1764. <ESC><SP>E    Full preservation of shift functions in 7 & 8 bit environments
  1765. <ESC><SP>F    C1 represented as <ESC>F   C1 represented as <ESC>F
  1766. <ESC><SP>G    C1 represented as <ESC>F   C1 represented as 8-bit quantity
  1767. <ESC><SP>H    All graphic character sets have 94 characters
  1768. <ESC><SP>I    All graphic character sets have 94 or 96 characters
  1769. <ESC><SP>J    In a 7 or 8 bit environment, a 7 bit code is used
  1770. <ESC><SP>K    In an 8 bit environment, an 8 bit code is used
  1771. <ESC><SP>L    Level 1 of ISO 4873 is used
  1772. <ESC><SP>M    Level 2 of ISO 4873 is used
  1773. <ESC><SP>N    Level 3 of ISO 4873 is used
  1774. <ESC><SP>P    G0 is used in addition to any other sets:
  1775.               G0 -(SI)-> GL              G0 -(LS0)-> GL
  1776. <ESC><SP>R    G1 is used in addition to any other sets:
  1777.               G1 -(SO)-> GL              G1 -(LS1)-> GL
  1778. <ESC><SP>S    G1 is used in addition to any other sets:
  1779.               G1 -(SO)-> GL              G1 -(LS1R)-> GR
  1780. <ESC><SP>T    G2 is used in addition to any other sets:
  1781.               G2 -(LS2)-> GL             G2 -(LS2)-> GL
  1782. <ESC><SP>U    G2 is used in addition to any other sets:
  1783.               G2 -(LS2)-> GL             G2 -(LS2R)-> GR
  1784. <ESC><SP>V    G3 is used in addition to any other sets:
  1785.               G3 -(LS2)-> GL             G3 -(LS3)-> GL
  1786. <ESC><SP>W    G3 is used in addition to any other sets:
  1787.               G3 -(LS2)-> GL             G3 -(LS3R)-> GR
  1788. <ESC><SP>Z    G2 is used in addition to any other sets:
  1789.               SS2 invokes a single character from G2
  1790. <ESC><SP>[    G3 is used in addition to any other sets:
  1791.               SS3 invokes a single character from G3
  1792.  
  1793.                      Table 9: ISO 2022 Announcer Summary
  1794. _____________________________________________________________________________
  1795.  
  1796.  
  1797.  
  1798. APPENDIX C: PRELIMINARY DESIGN FOR LOADABLE TRANSLATION TABLES
  1799.  
  1800. Note the word "PRELIMINARY".  This design will be refined as attempts are made
  1801. to program it.
  1802.  
  1803. The translation table is specified in a file written entirely in printable
  1804. ASCII, with line divisions as shown.  Numbers are represented as ASCII decimal
  1805. digits.
  1806.  
  1807. Line  Contents
  1808.  1.    Name of this table
  1809.  2.    The word "COMMON" or "LOCAL"
  1810.  3.    Name of SOURCE character set (translating FROM)
  1811.  4.    Number of bytes per character of source set (1, 2, 3, 1-2, etc)
  1812.  5.    Number of characters per plane of source set (94, 96, 128)
  1813.  6.    Name of TARGET character set (translating TO)
  1814.  7.    Number of bytes per character of target set (1, 2, 3, 1-2, etc)
  1815.  8.    Number of characters per plane of target set (94, 96, 128)
  1816.  9.    Designating sequence for COMMON character set.
  1817. 10.    Version number of common character set (blank if none)
  1818. 11.    Registration number of common character set (e.g. I2/100, blank if none)
  1819. 12.    Direction of writing (Left-to-right, Right-to-left, Upwards, etc)
  1820. 13.    Number of entries in the translation table.
  1821. 14.    Count of lines, n, between this line and beginning of translation table.
  1822. 15 - 15+n.  Reserved for future use.
  1823. n+16...     The translation table itself.
  1824.  
  1825. Line 2 is either COMMON or LOCAL, and applies to the SOURCE character set.
  1826. LOCAL means that the source character set is local, and the target character
  1827. set is common, i.e. the one used during transmission in the transfer syntax.
  1828. COMMON means vice-versa.
  1829.  
  1830. Line 3 gives the name of the source character set, which is either local or
  1831. common, depending on line 2.
  1832.  
  1833. Line 4 specifies the number of bytes per character in the source character
  1834. set.  For example, 1 for ASCII, ISO Latin-1, etc, 2 for JIS X 0208, etc.
  1835. The notation "1-2" means that a character can be either one or two bytes, as
  1836. in (for instance) CCITT T.61, where "A" is the single character "A", but
  1837. "`A" is the single character A-grave.
  1838.  
  1839. Line 5 specifies the number of "characters per plane".  In a single-byte
  1840. character set, there is one plane, in a multibyte set there are many.  In the
  1841. ISO world, an important distinction is made between 94-byte sets and 96-byte
  1842. sets.  See Appendix B for a fuller explanation.
  1843.  
  1844. Lines 6-8 are like lines 2-5, but for the target character set.  If the source
  1845. set was local, the target set is common, and vice versa.
  1846.  
  1847. Lines 9-11 give further information about the standard, COMMON character set:
  1848. Line 9 specifies the designating sequences required to assign the set to G0,
  1849. G1, G2, and G3 (see Table 6), in that order, with the bytes written as decimal
  1850. numbers, each byte separated by a space, and each sequence separated by a
  1851. comma.  For example, the entry for a 94-character set whose final designating
  1852. letter is "B" would look like this:
  1853.  
  1854.   27 40 66, 27 41 66, 27 42 66, 27 43 66
  1855.  
  1856. If a character set cannot be assigned to G0 (as is the case with a 96-byte
  1857. set), then the first entry would be left blank (the final letter here is A):
  1858.  
  1859.   , 27 45 65, 27 46 65, 27 47 65
  1860.  
  1861. Line 10 gives the revision number of the common character set, as described in
  1862. the "Data Transfer Protocol" section of the description of Level 2.  This
  1863. should be blank if the character set has not been revised, @ (atsign) for the
  1864. first revision, A for the second revision, B for the third revision, etc.
  1865.  
  1866. Line 11 gives the Kermit designator of the common character set, such as
  1867. I2/100 for ISO Latin Alphabet 1.
  1868.  
  1869. Line 12, direction of writing, has nothing to do with file transfer, but is
  1870. included in case the same table is also to be used with terminal emulation.
  1871. The actual notation should be the letter L (Left-to-right), R (Right-to-left),
  1872. U (Upwards), D (Downwards), or B (Boustrophedon, i.e. alternating L and R).
  1873.  
  1874. Line 13 is self explanatory.
  1875.  
  1876. Line 14 allows for future expansion of this "information header".
  1877.  
  1878. Lines 15 through the end contain the translation table itself.  Each of these
  1879. lines contains a pair of characters or strings in ASCII decimal
  1880. representation, with the members of the pair separated by a comma, followed
  1881. optionally by a comment, like "Uppercase A Circumflex"
  1882.  
  1883.     <character from transfer set>, <character from local set> ; <comment>
  1884.  
  1885. Each byte of a character is separated by a space, for example:
  1886.  
  1887.     231, 135           ; c Cedilla (Latin-1 to CP850)
  1888.     228, 97 101        ; Latin-1 a-umlaut to ASCII "ae"
  1889.     97 101, 228        ; "ae" to Latin-1 a-umlaut (dangerous!)
  1890.    123 456, 234 567    ; Something from a pair of 2-byte character sets
  1891.  
  1892. The character pair is listed, rather than a single value (as in most
  1893. translation tables) to allow for special translations like a-umlaut to "ae".
  1894.  
  1895. There is no rule against having different numbers of bytes on either side of
  1896. the comma.  There is also no requirement to always have the same number of
  1897. bytes on the left or right side of the comma, nor to have every position
  1898. filled.  If a position is vacant, the program should take some kind of default
  1899. action, like substituting a question mark.
  1900.  
  1901.  
  1902.  
  1903. APPENDIX D: SUMMARY OF NEW KERMIT COMMANDS
  1904.  
  1905.  
  1906. SET FILE TYPE { BINARY, TEXT, <other> }
  1907.  
  1908.     BINARY means no translation, and overrides all other file-related
  1909.     commands, including SET TRANSFER.
  1910.  
  1911.     TEXT is the default.  Enables Level 0, 1, or 2 transfer syntax,
  1912.     depending on the setting of SET TRANSFER.
  1913.  
  1914.     <other> means any application-specific format known to the Kermit
  1915.     program, like WORDPERFECT.  The meaning of such a command is
  1916.     system- and/or application-dependent.
  1917.  
  1918. SET FILE CHARACTER-SET <name>
  1919.  
  1920.     Effective only when file type is TEXT.
  1921.     Tells Kermit what character set the file is coded in,
  1922.     or what character set to translate an incoming file to.
  1923.  
  1924. SET TRANSFER { CHARACTER-SET <name>, INTERNATIONAL [{7,8}], NORMAL }
  1925.  
  1926.     CHARACTER-SET <name> invokes the Level 1 extension, unless the
  1927.       <name> is TRANSPARENT or ASCII.
  1928.  
  1929.     INTERNATIONAL invokes the Level 2 extension.  7 or 8 specifies the
  1930.       ISO-2022 7- or 8-bit environment.
  1931.  
  1932.     NORMAL - SET TRANSFER NORMAL is synonym for SET TRANSFER
  1933.     CHARACTER-SET ASCII.
  1934.  
  1935. SET LANGUAGE <name>
  1936.  
  1937.     This command informs the program which language is being translated,
  1938.     to allow for special language-based translation tricks, such as
  1939.     a-umlaut => ae.
  1940.  
  1941. SET UNKNOWN-CHARACTER-SET { KEEP, CANCEL }
  1942.  
  1943.     Tells the file receiver whether to keep or cancel an incoming file that
  1944.     contains an unknown character set.  KEEP is the default.
  1945.  
  1946. LOAD TRANSLATION-TABLE <tablename> <filename>
  1947.  
  1948.     Load a new translation table, or overlay an existing one, from the
  1949.     specified file.
  1950.  
  1951. SHOW TRANSLATION-TABLE <name>
  1952.  
  1953.     Show information about the named translation table.  If <name> omitted,
  1954.     show information about all translation tables.    
  1955.  
  1956. DUMP TRANSLATION-TABLE <name> <filename>
  1957.  
  1958.     Write the contents of the named table to the specified file, in a format
  1959.     compatible with the LOAD TRANSLATION-TABLE command.
  1960.  
  1961. DROP TRANSLATION-TABE <name>
  1962.  
  1963.     Remove the named translation table from Kermit's memory and command
  1964.     keyword tables.
  1965.  
  1966. SET ATTRIBUTES { ON, OFF }
  1967. SET ATTRIBUTE <name-of-attribute> { ON, OFF }
  1968.  
  1969.     Enables or disables processing of attribute packets, or specific
  1970.     attribute fields such as DATE, CHARACTER-SET, LENGTH, etc.
  1971.  
  1972. SHOW { CHARACTER-SETS, TRANSLATION-TABLES, LANGUAGE }
  1973.  
  1974.     Display what character sets, translation tables, and languages are
  1975.     available, and which ones are currently selected.
  1976.  
  1977. TRANSLATE <file1> <file2>
  1978.  
  1979.     Copies local file <file1> to local file <file2>, translating <file1>
  1980.     from the current file character-set into the current transfer
  1981.     character-set.
  1982.     
  1983.  
  1984.  
  1985. APPENDIX E:
  1986. ESCAPE SEQUENCES AND CONTROL CHARACTERS FOR KERMIT LEVEL-2 TRANSFER SYNTAX
  1987.  
  1988. 1. Designation of character sets.
  1989.    The final letter "F" denotes the character set, e.g. "A" for ISO Latin-1.
  1990.  
  1991.   <ESC>(F     assigns 94-character graphics set "F" to G0.
  1992.   <ESC>)F     assigns 94-character graphics set "F" to G1.
  1993.   <ESC>*F     assigns 94-character graphics set "F" to G2.
  1994.   <ESC>+F     assigns 94-character graphics set "F" to G3.
  1995.   <ESC>-F     assigns 96-character graphics set "F" to G1.
  1996.   <ESC>.F     assigns 96-character graphics set "F" to G2.
  1997.   <ESC>/F     assigns 96-character graphics set "F" to G3.
  1998.   <ESC>$(F    assigns multibyte character set "F" to G0.
  1999.   <ESC>$)F    assigns multibyte character set "F" to G1.
  2000.   <ESC>$*F    assigns multibyte character set "F" to G2.
  2001.   <ESC>$+F    assigns multibyte character set "F" to G3.
  2002.  
  2003. 2. Shift functions:
  2004.  
  2005. Character(s) Name      Function 
  2006.   Ctrl-O      SI,LS0    Shift In (invoke G0 to GL)
  2007.   Ctrl-N      SO,LS1    Shift Out (invoke G1 to GL)
  2008.   <ESC>n      LS2       Locking Shift 2 (invoke G2 to GL)
  2009.   <ESC>o      LS3       Locking Shift 3 (invoke G3 to GL)
  2010.   <ESC>~      LS1R      Locking Shift 1 Right (invoke G1 to GR)
  2011.   <ESC>}      LS2R      Locking Shift 2 Right (invoke G2 to GR)
  2012.   <ESC>|      LS3R      Locking Shift 3 Right (invoke G3 to GR)
  2013.   <ESC>N      SS2       Single Shift 2, 7-bit version, single char from G2
  2014.    08/14      SS2       Single Shift 2, 8-bit version, single char from G2
  2015.   <ESC>O      SS3       Single Shift 3, 7-bit version, single char from G3
  2016.    08/15      SS3       Single Shift 3, 8-bit version, single char from G3
  2017.  
  2018. 3. Coding method delimiter:
  2019.  
  2020. When receiving text in an unknown character set, store the character set
  2021. designator, then store the untranslated characters, and terminate with the
  2022. coding method delimiter.
  2023.  
  2024.   <ESC>d
  2025.  
  2026. 4. Special characters in data:
  2027.  
  2028. If any of the following characters appear in the data itself, they must be
  2029. prefixed during transmission with <DLE>, datalink escape, 01/00, Control-P:
  2030.  
  2031.   <SO>   00/14
  2032.   <SI>   00/15
  2033.   <DLE>  01/00
  2034.   <ESC>  01/11
  2035.   <SS2>  08/14
  2036.   <SS3>  08/15
  2037.  
  2038.  
  2039.  
  2040. APPENDIX F: SELECTING LEVEL 0, LEVEL 1, AND LEVEL 2
  2041.  
  2042. A Kermit program operates in Level 0 by default.  The transfer character set
  2043. is ASCII, and if Attribute packets are used, the encoding attribute is "*!A",
  2044. and the character-set attribute "2" is not used.
  2045.  
  2046. To enter Level 0:
  2047.   SET TRANSFER CHARACTER-SET ASCII enters Level 0 from any level.  SET TRANSFER
  2048.   NORMAL does exactly the same thing.  The two commands are synonyms.
  2049.  
  2050. To enter Level 1:
  2051.   SET TRANSFER CHARACTER-SET <name>, where <name> is not ASCII, enters Level 1
  2052.   from any level.  If Attribute packets are used, the encoding attribute is
  2053.   "*!C" and the character-set attribute must be specified.  If Level 1 is
  2054.   entered, exited, and entered again, the transfer character set must be
  2055.   respecified.
  2056.  
  2057. To enter Level 2:
  2058.   SET TRANSFER INTERNATIONAL enters Level 2 from any level.  Attribute packets
  2059.   should be used at this level.  The encoding attribute is "*xIyyy" where "x"
  2060.   is the number of characters to follow, "I" signifies international transfer
  2061.   syntax, and "yyy" is 0 or more ISO-2022 facility announcers.  The
  2062.   character-set attribute may also be included, if the program knows in
  2063.   advance which character sets are in the file.  In this case the Kermit
  2064.   character-set designators for each set are listed, separated by commas, for
  2065.   example "2-I2/100,I2/144".
  2066.  
  2067.  
  2068.  
  2069. APPENDIX G: SIMPLIFIED FLOW DIAGRAM OF KERMIT TRANSFER SYNTAX OPTIONS
  2070.  
  2071.  
  2072.   SET FILE TYPE BINARY (overrides SET TRANSFER command)
  2073.   |    |
  2074.   N    Y-->  Transfer file unmodified.  END.
  2075.   |
  2076.   Text mode.  Three possibilities:
  2077.   SET TRANSFER CHARACTER-SET TRANSPARENT (or ASCII)
  2078.   |    |
  2079.   N    Y-->  LEVEL 0: Transfer syntax is ASCII with CRLF as line terminator.
  2080.   |          Sending program translates from local format to transfer syntax,
  2081.   |          Receiving program translates from transfer syntax to local format.
  2082.   |          END.
  2083.   |
  2084.   SET TRANSFER CHARACTER-SET LATIN1 (any single character set other than ASCII)
  2085.   |    |
  2086.   N    Y-->  LEVEL 1: Transfer syntax is specified character set with CRLFs.
  2087.   |          Sender translates from local format to specified character set.
  2088.   |          Receiver translates from specified character set to local format.
  2089.   |          END.
  2090.   |
  2091.   File composed of more than one character set:
  2092.   SET TRANSFER INTERNATIONAL
  2093.   |    |
  2094.   N    Y-->  LEVEL 2: Transfer syntax is ISO-2022.  Assumes that sender can
  2095.   |          identify the different character sets in the local file, and
  2096.   |          can translate them to registered character sets if necessary.
  2097.   |          |
  2098.   |          Sender specifies encoding ("*") to be International ("I"),
  2099.   |          and lists ISO-2022 announcers.  Sender also optionally lists the
  2100.   |          alphabets to be used in new character-set ("2") attribute.
  2101.   |          |
  2102.   |          Receiver agrees to these facilities and alphabets?
  2103.   |          |    |
  2104.   |          Y    N --> Receiver rejects the file, indicating "*" and/or "2"
  2105.   |          |          as the reason.  END.
  2106.   |          |
  2107.   |          Receiver accepts the file.
  2108.   |          |
  2109.   |          Transfer begins.  Sender translates from local file format to
  2110.   |          the character sets of the transfer syntax, using ISO-2022
  2111.   |          announcers, designators, and shifts to switch among them.
  2112.   |          |
  2113.   |          2 --> Receiver heeds announcers, designators, and shifts, and
  2114.   |                translates from the indicated character sets to local 
  2115.   |                representation.
  2116.   |                |
  2117.   |                If the receiver encounters an alphabet it does not know, it 
  2118.   |                will act according to the SET UNKNOWN-CHARACTER-SET command:
  2119.   |                |      |
  2120.   |                KEEP   CANCEL --> Reject the file by putting an X (Cancel 
  2121.   |                |                 File) code in the data field of its 
  2122.   |                |                 Acknowledgement.  END.
  2123.   |                |
  2124.   |                (default) Continue to receive the file, but store the 
  2125.   |                designator for the unknown alphabet along with the 
  2126.   |                untranslated characters from that alphabet, until the next 
  2127.   |                known alphabet is encountered.  Mark the end of the 
  2128.   |                untranslated material with <ESC>d.  Warn user.
  2129.   |                |
  2130.   |                END.
  2131.   |
  2132.   Reserved for future
  2133.  
  2134. (END)
  2135.