home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / internat / 833 < prev    next >
Encoding:
Text File  |  1992-12-14  |  13.4 KB  |  290 lines

  1. Xref: sparky comp.std.internat:833 soc.culture.nordic:7849 soc.culture.german:9228
  2. Path: sparky!uunet!cs.utexas.edu!qt.cs.utexas.edu!yale.edu!ira.uka.de!fauern!uni-erlangen.de!not-for-mail
  3. From: unrza3@cd4680fs.rrze.uni-erlangen.de (Markus Kuhn)
  4. Newsgroups: comp.std.internat,soc.culture.nordic,soc.culture.german
  5. Subject: ISO Latin 1 to 7-bit ASCII conversion (final draft!)
  6. Date: 14 Dec 1992 14:23:03 +0100
  7. Organization: Regionales Rechenzentrum Erlangen
  8. Message-ID: <1gi1rnEINN1cg@uni-erlangen.de>
  9. Reply-To: mskuhn@immd4.informatik.uni-erlangen.de
  10. NNTP-Posting-Host: cd4680fs.rrze.uni-erlangen.de
  11. Lines: 276
  12. Keywords: character sets, ISO 8859-1, terminals, user interface
  13.  
  14. I received quite a number of suggestions for improvement of the conversion
  15. tables which I posted to comp.std.internat a few weeks ago. Before I
  16. will send the following text to a number of public domain software
  17. authors, I'd like to ask you again for a final comment on these
  18. tables. Would you as a user who has still to live with an 7-bit
  19. terminal and who receives ISO Latin 1 textes be happy, if your
  20. favourite piece of networking software would be able to display
  21. the characters as described below? If not, what would you like
  22. to change?
  23.  
  24. Markus
  25.  
  26. ------------------------------------------------------------------------
  27. Representation of ISO 8859-1 characters with 7-bit ASCII
  28. --------------------------------------------------------
  29.  
  30. Markus Kuhn -- 1992-12-13
  31.  
  32. SUMMARY: This text describes a technique of displaying the 8-bit
  33. character set, which is used today in many modern network services, on
  34. old 7-bit terminals. Authors of software dealing with text received
  35. from international networks are strongly encouraged to implement this
  36. or similar methods as options in their software for the convenience of
  37. users all over the world. Implementation is often trivial.
  38.  
  39.  
  40.  
  41. The "Latin alphabet No. 1" defined in part 1 of the international
  42. standard
  43.  
  44.   ISO 8859:1987   Information processing -- 8-bit single-byte
  45.                   coded graphic character sets
  46.  
  47. is an increasingly popular 8-bit extension of the traditional 7-bit
  48. US-ASCII character set. It is already supported by many operating
  49. systems and its 191 graphic characters include those used in the
  50. following 14 languages:
  51.  
  52.   Danish, Dutch, English, Faeroese, Finnish, French, German,
  53.   Icelandic, Irish, Italian, Norwegian, Portuguese, Spanish and
  54.   Swedish.
  55.  
  56. ISO 8859-1 contains graphic characters used in at least 44 countries.
  57. Many people believe that ISO Latin 1 is already the de-facto
  58. replacement of the old 7-bit US-ASCII character set. In addition, the
  59. first 256 characters of the new 16-bit character set ISO 10646/Unicode,
  60. which contains nearly all characters used on this planet and is
  61. expected to be the final solution of most of today's character set
  62. troubles, are identical with ISO 8859-1.
  63.  
  64. ISO 8859-1 uses only the codes 32-126 (which are identical with
  65. US-ASCII) and 160-255. The positions 0-31 and 127-159 are reserved for
  66. control codes and normally used in the same way in which they are used
  67. with ASCII.
  68.  
  69. As this character set gains more and more popularity in international
  70. data communication (e.g. the Internet gopher service, the Internet
  71. MIME, parts of USENET), the need arises to extend existing software
  72. with the ability of displaying strings containing ISO 8859-1 characters
  73. on old hardware that is only capable of displaying 7-bit US-ASCII
  74. characters. Today, many users of old hardware suffer from getting the
  75. Latin 1 characters between 160 and 255 only displayed as the
  76. corresponding US-ASCII characters with the highest bit cleared. Then
  77. they see e.g. a ')' instead of the copyright symbol. Pessimists expect
  78. that these old 7-bit terminals will be in use at least for the next ten
  79. years.
  80.  
  81. One approach for such a Latin 1 to ASCII conversion is to use the
  82. replacements, that people use traditionally, when they have to live
  83. with an US-ASCII keyboard. This seems to be the most natural method,
  84. which often won't even be noticed by users that use these traditional
  85. replacements already today on their old hardware.
  86.  
  87. The disadvantages of this approach are often acceptable:
  88.  
  89.   a) No one-to-one mapping between Latin 1 and ASCII strings possible
  90.   b) Text layout may be destroyed by multi-character substitutions
  91.   c) Different replacements may be in use for different languages
  92.  
  93. There is no optimal solution possible for the problem of displaying
  94. text with ISO Latin 1 characters on old terminals apart from buying new
  95. hardware. The conversion tables proposed here are only intermediate
  96. solutions that are intended to make life easier for people who get
  97. Latin 1 characters currently displayed as the corresponding 7-bit
  98. US-ASCII symbols with the highest bit cleared, which is awful and
  99. frustrates the users of old hardware.
  100.  
  101. Including the tables below in programs like mail user agents, news
  102. readers, gopher clients, file browsers, tty drivers etc. is often a
  103. trivial task. Users should be able to switch between the different
  104. tables and the 8-bit transparent normal mode. User defineable tables
  105. are always a nice possible extension.
  106.  
  107. Users should know if the text they read has been converted from the 
  108. original Latin 1 text. This avoids confusion if e.g. someone asks for
  109. sending him a 3<fraction 1/2>" disk [3╜"], which will be displayed
  110. after the conversion as 31/2" (= 15.25").
  111.  
  112. I collected four tables based on information I received from many
  113. USENET readers from various countries in order to cope with the
  114. different needs of ISO Latin 1 users. First of all, a table with the
  115. real characters in the range 160 - 255 (0xa0 - 0xff):
  116.  
  117.  
  118.    á   í   ó   ú   ñ   Ñ   ª   º   ¿   ⌐   ¬   ½   ¼   ¡   «   »
  119.    ░   ▒   ▓   │   ┤   ╡   ╢   ╖   ╕   ╣   ║   ╗   ╝   ╜   ╛   ┐
  120.    └   ┴   ┬   ├   ─   ┼   ╞   ╟   ╚   ╔   ╩   ╦   ╠   ═   ╬   ╧
  121.    ╨   ╤   ╥   ╙   ╘   ╒   ╓   ╫   ╪   ┘   ┌   █   ▄   ▌   ▐   ▀
  122.    α   ß   Γ   π   Σ   σ   µ   τ   Φ   Θ   Ω   δ   ∞   φ   ε   ∩
  123.    ≡   ±   ≥   ≤   ⌠   ⌡   ÷   ≈   °   ∙   ·   √   ⁿ   ²   ■    
  124.  
  125. Table 0 is a universal table that is expected to be suitable for many
  126. languages. The letters are simply the ASCII versions without the
  127. diacritics. The character '?' as a fallback substitution where no ASCII
  128. string is suitable is used as little as possible, as '?' carries no
  129. information and if we are pedantic, we have to replace nearly every
  130. Latin 1 character over 160 by question marks.
  131.  
  132.        !   c   ?   ?   Y   |   ?   " (c)   a  <<   -   - (R)   ?
  133.    ? +/-   2   3   '  mu   P   .   ,   1   o  >> 1/4 1/2 3/4   ?
  134.    A   A   A   A   A   A  AE   C   E   E   E   E   I   I   I   I
  135.    D   N   O   O   O   O   O   x   O   U   U   U   U   Y  Th  ss
  136.    a   a   a   a   a   a  ae   c   e   e   e   e   i   i   i   i
  137.    d   n   o   o   o   o   o   :   o   u   u   u   u   y  th   y
  138.  
  139. Table 1 replaces Latin 1 characters only with single ASCII characters.
  140. This won't destroy the layout of textes designed to be printed with
  141. monospaced fonts, but the replacements are often not very satisfactory:
  142.  
  143.        !   c   ?   ?   Y   |   ?   "   c   a   <   -   -   R   ?
  144.    ?   ?   2   3   '   u   P   .   ,   1   o   >   ?   ?   ?   ?
  145.    A   A   A   A   A   A   A   C   E   E   E   E   I   I   I   I
  146.    D   N   O   O   O   O   O   x   O   U   U   U   U   Y   T   s
  147.    a   a   a   a   a   a   a   c   e   e   e   e   i   i   i   i
  148.    d   n   o   o   o   o   o   :   o   u   u   u   u   y   t   y
  149.  
  150. In some languages, only removing the diacritics as in table 0 gives
  151. orthographically incorrect and unappropriate results. The following
  152. table 2 might be much more suitable that table 0 in Danish, Dutch,
  153. German, Norwegian and Swedish:
  154.  
  155.        !   c   ?   ?   Y   |   ?   " (c)   a  <<   -   - (R)   ?
  156.    ? +/-   2   3   '  mu   P   .   ,   1   o  >> 1/4 1/2 3/4   ?
  157.    A   A   A   A  Ae  Aa  AE   C   E   E   E   E   I   I   I   I
  158.    D   N   O   O   O   O  Oe   x   O   U   U   U  Ue   Y  Th  ss
  159.    a   a   a   a  ae  aa  ae   c   e   e   e   e   i   i   i   i
  160.    d   n   o   o   o   o  oe   :   o   u   u   u  ue   y  th  ij
  161.  
  162. In some north european languages, any US-ASCII replacement for the
  163. relevant Latin 1 characters is unacceptable for many people. In these
  164. countries, national variants of 7-bit ISO 646 are still very popular.
  165. These use the codes of []{}\|~^`$ for national characters. Table 2 has
  166. been designed for Danish, Finnish, Norwegian and Swedish users of ISO
  167. 646 terminals:
  168.  
  169.        !   c   ?   $   Y   |   ?   " (c)   a  <<   -   - (R)   ?
  170.    ? +/-   2   3   '  mu   P   .   ,   1   o  >> 1/4 1/2 3/4   ?
  171.    A   A   A   A   [   ]   [   C   E   @   E   E   I   I   I   I
  172.    D   N   O   O   O   O   \   x   \   U   U   U   ^   Y  Th  ss
  173.    a   a   a   a   {   }   {   c   e   `   e   e   i   i   i   i
  174.    d   n   o   o   o   o   |   :   |   u   u   u   ~   y  th   y
  175.  
  176.  
  177. For the convenience of C programmers, I included the code of these
  178. tables in this text. Just copy the following lines in your software:
  179.  
  180. -----------------------------------------------------------------------
  181. /* Conversion tables for displaying the G1 set (0xa0-0xff) of
  182.    ISO Latin 1 (ISO 8859-1) with 7-bit ASCII characters.
  183.    Suggestions for improvement are welcome!
  184.  
  185.    Table   Purpose
  186.      0     universal table for many languages
  187.      1     single-spacing universal table
  188.      2     table for Danish, Dutch, German, Norwegian and Swedish
  189.      3     table for Danish, Finnish, Norwegian and Swedish using ISO 646
  190.  
  191.    Markus Kuhn <mskuhn@immd4.informatik.uni-erlangen.de>                 */
  192.  
  193. #define SUB "?"        /* used if no reasonable ASCII string is possible */
  194. #define ISO_TABLES 4
  195.  
  196. static unsigned char *iso2asc[ISO_TABLES][96] = {{
  197.   " ","!","c",SUB,SUB,"Y","|",SUB,"\"","(c)","a","<<","-","-","(R)",SUB,
  198.   SUB,"+/-","2","3","'","mu","P",".",",","1","o",">>","1/4","1/2","3/4","?",
  199.   "A","A","A","A","A","A","AE","C","E","E","E","E","I","I","I","I",
  200.   "D","N","O","O","O","O","O","x","O","U","U","U","U","Y","Th","ss",
  201.   "a","a","a","a","a","a","ae","c","e","e","e","e","i","i","i","i",
  202.   "d","n","o","o","o","o","o",":","o","u","u","u","u","y","th","y"
  203. },{
  204.   " ","!","c",SUB,SUB,"Y","|",SUB,"\"","c","a","<","-","-","R",SUB,
  205.   SUB,SUB,"2","3","'","u","P",".",",","1","o",">",SUB,SUB,SUB,"?",
  206.   "A","A","A","A","A","A","A","C","E","E","E","E","I","I","I","I",
  207.   "D","N","O","O","O","O","O","x","O","U","U","U","U","Y","T","s",
  208.   "a","a","a","a","a","a","a","c","e","e","e","e","i","i","i","i",
  209.   "d","n","o","o","o","o","o",":","o","u","u","u","u","y","t","y"
  210. },{
  211.   " ","!","c",SUB,SUB,"Y","|",SUB,"\"","(c)","a","<<","-","-","(R)",SUB,
  212.   SUB,"+/-","2","3","'","mu","P",".",",","1","o",">>","1/4","1/2","3/4","?",
  213.   "A","A","A","A","Ae","Aa","AE","C","E","E","E","E","I","I","I","I",
  214.   "D","N","O","O","O","O","Oe","x","O","U","U","U","Ue","Y","Th","ss",
  215.   "a","a","a","a","ae","aa","ae","c","e","e","e","e","i","i","i","i",
  216.   "d","n","o","o","o","o","oe",":","o","u","u","u","ue","y","th","ij"
  217. },{
  218.   " ","!","c",SUB,"$","Y","|",SUB,"\"","(c)","a","<<","-","-","(R)",SUB,
  219.   SUB,"+/-","2","3","'","mu","P",".",",","1","o",">>","1/4","1/2","3/4","?",
  220.   "A","A","A","A","[","]","[","C","E","@","E","E","I","I","I","I",
  221.   "D","N","O","O","O","O","\\","x","\\","U","U","U","^","Y","Th","ss",
  222.   "a","a","a","a","{","}","{","c","e","`","e","e","i","i","i","i",
  223.   "d","n","o","o","o","o","|",":","|","u","u","u","~","y","th","y"
  224. }};
  225. -----------------------------------------------------------------------
  226.  
  227. One might perhaps replace the "?" in SUB with another code that will be
  228. displayed as a blinking question mark or something similar. Then the
  229. user will know that the software wants to tell him/her that it can't
  230. display this symbol and that it isn't a question mark. If your software
  231. runs on hardware that supports already another 8-bit characters set
  232. (e.g. IBM PC with code page 437, etc.) then it might be a much better
  233. idea to include only one single table that uses the supported symbols
  234. as well as possible and uses the strings suggested here only if no
  235. better alternative is available. (BTW: IBM code page 850 which is
  236. supported by MS-DOS and OS/2 contains ALL Latin 1 characters, but at
  237. other positions, in order to stay compatible with the old IBM PC
  238. character set.)
  239.  
  240. The following string conversion routine uses these tables. It may
  241. easily be called before a text received from the network is sent to the
  242. terminal, if the user has selected one of the tables:
  243.  
  244. -----------------------------------------------------------------------
  245. /*
  246.  *  Transform an 8-bit ISO Latin 1 string s1 in a 7-bit ASCII string s2
  247.  *  readable on old terminals using conversion table t.
  248.  *
  249.  *  worst case: strlen(s2) == 3*strlen(s1)
  250.  */
  251.   void
  252. Latin1toASCII(s1, s2, t)
  253.   unsigned char *s1, *s2;
  254.   int t;
  255. {
  256.   unsigned char *p, **tab;
  257.  
  258.   if (s1==NULL || s2==NULL) return;
  259.  
  260.   tab = iso2asc[t] - 0xa0;
  261.   do {
  262.     if (*s1 > 0x9f) {
  263.       p = tab[*(s1++)];
  264.       while (*p) *(s2++) = *(p++);
  265.     } else {
  266.       *(s2++) = *(s1++);
  267.     }
  268.   } while (*s1);
  269.  
  270.   return;
  271. }
  272. -----------------------------------------------------------------------
  273.  
  274. Many users all over the world are looking forward to your next software
  275. release that will allow them to participate without pain in the world
  276. of 8-bit character communication even before they get modern hardware
  277. with ISO 8859-1 (or even better ISO 10646) character sets.
  278.  
  279. Feel free to contact me or experts in USENET group comp.std.internat if
  280. you have any questions about modern character sets. Many thanks to
  281. everyone who helped me to improve these tables!
  282.  
  283. Markus
  284.  
  285. -- 
  286. Markus Kuhn, Computer Science student -=-=- University of Erlangen, Germany
  287. Internet: mskuhn@immd4.informatik.uni-erlangen.de  |  X.500 entry available
  288. ----- Anyone participating in the use of MS-DOS, Heroin or Cocaine is -----
  289. ---- simply not getting the most out of life possible. (Brian Downing) ----
  290.