"Fossies" - the Fresh Open Source Software Archive

Member "tin-2.4.1/doc/iso2asc.txt" (28 Aug 2013, 23621 Bytes) of archive /linux/misc/tin-2.4.1.tar.gz:


As a special service "Fossies" has tried to format the requested text file into HTML format (style: standard) with prefixed line numbers. Alternatively you can here view or download the uninterpreted source code file.

    1 Representation of ISO 8859-1 characters with 7-bit ASCII
    2 --------------------------------------------------------
    3 
    4 Markus Kuhn -- 1993-02-20
    5 
    6 SUMMARY: This text describes a technique of displaying the 8-bit
    7 character set, which is used today in many modern network services, on
    8 old 7-bit terminals. Authors of software dealing with text received
    9 from international networks are strongly encouraged to implement this
   10 or similar methods as options in their software for the convenience of
   11 users all over the world. Implementation is often trivial.
   12 
   13 
   14 
   15 The "Latin alphabet No. 1" defined in part 1 of the international
   16 standard
   17 
   18   ISO 8859:1987   Information processing -- 8-bit single-byte
   19                   coded graphic character sets
   20 
   21 is an increasingly popular 8-bit extension of the traditional 7-bit
   22 US-ASCII character set. It is already supported by many operating
   23 systems and its 191 graphic characters include those used in at least
   24 the following 14 languages (and many others):
   25 
   26   Danish, Dutch, English, Faeroese, Finnish, French, German,
   27   Icelandic, Irish, Italian, Norwegian, Portuguese, Spanish and
   28   Swedish.
   29 
   30 ISO 8859-1 contains graphic characters used in at least 44 countries.
   31 ISO Latin 1 is already the de-facto replacement of the old 7-bit
   32 US-ASCII character set and its national ISO 646 variants. In addition,
   33 the first 256 characters of the new 16-bit character set ISO
   34 10646/Unicode, which will eventually contain all characters used on
   35 this planet and is expected to be the final solution of most of today's
   36 character set troubles, are identical with ISO 8859-1.
   37 
   38 ISO 8859-1 uses only the codes 32-126 (which are identical with
   39 US-ASCII) and 160-255. The positions 0-31 and 127-159 are reserved for
   40 control characters and normally used in the same way in which they are
   41 used with ASCII.
   42 
   43 By the way: Only two of the characters have a special meaning for
   44 programs that allow paragraph reformatting. Character NBSP (no-break
   45 space) number 160 (0xa0 = ' '+0x80) looks like a normal space and
   46 should be used if a line break is to be prevented at this space in the
   47 text when it is formatted. Character SHY (soft hyphen) at position 173
   48 (0xad = '-'+0x80) looks similar to or exactly like the normal hyphen
   49 ('-') and should be used when a line break has been established within
   50 a word. In this way, SHY can easily be removed again by an editor while
   51 reformatting a paragraph, because soft hyphens (0xad) that have only
   52 been inserted for line breaks can be distinguished from real hyphens
   53 (0x2d) that are a permanent part of the text. Both NBSP and SHY are
   54 part of all ISO 8859 character sets.
   55 
   56 As the ISO Latin 1 character set gains more and more popularity in
   57 international data communication (e.g. the Internet gopher service, the
   58 Internet MIME, parts of USENET), the need arises to extend existing
   59 software with the ability of displaying strings containing ISO 8859-1
   60 characters on old hardware that is only capable of displaying 7-bit
   61 US-ASCII characters. Today, many users of old hardware suffer from
   62 getting the Latin 1 characters between 160 and 255 only displayed as
   63 the corresponding US-ASCII characters with the highest bit cleared.
   64 Then they see e.g. a ')' instead of the copyright symbol. Pessimists
   65 expect that these old 7-bit terminals will be in use at least for the
   66 next ten years.
   67 
   68 One approach for a Latin 1 to ASCII conversion is to use the
   69 replacements that people commonly use when they have to live with a
   70 system supporting a too limited character set. This seems to be the
   71 most natural method, which often won't even be noticed by users that
   72 use these traditional replacements already today on their old hardware.
   73 
   74 Of course, there are some disadvantages of this approach (compared to
   75 buying a new terminal), but these are often acceptable if the software
   76 today simply destroys the characters by clearing the highest bit of the
   77 received bytes. These are:
   78 
   79   a) No one-to-one mapping between Latin 1 and ASCII strings is possible.
   80   b) Text layout may be destroyed by multi-character substitutions,
   81      especially in tables.
   82   c) Different replacements may be in use for different languages,
   83      so no single standard replacement table will make everyone happy.
   84   d) Truncation or line wrapping might be necessary to fit textual data
   85      into fields of fixed width.
   86 
   87 There is no optimal solution possible for the problem of displaying
   88 text with ISO Latin 1 characters on old terminals apart from buying new
   89 hardware. The conversion tables proposed here are only intermediate
   90 solutions that are intended to make life easier for people who get
   91 Latin 1 characters currently displayed as the corresponding 7-bit
   92 US-ASCII symbols with the highest bit cleared, which is awful and
   93 frustrates the users of old hardware.
   94 
   95 Including the tables below in programs like mail user agents, news
   96 readers, gopher clients, file browsers, tty drivers etc. is often a
   97 trivial task. Users should be able to switch between the different
   98 tables and the 8-bit transparent normal mode.
   99 
  100 While I discussed these tables with people from many nations in USENET,
  101 it became obvious, that there are a lot of differences in the personal
  102 and cultural preferences for the substitution tables. Much too many
  103 tables would have been necessary to make everyone 100% happy. So I
  104 decided to keep the number of tables as small as possible and tried to
  105 cover only the most important cultural and application dependent
  106 differences. The tables below will perhaps be all right for 80% of the
  107 users. If you as a programmer want to avoid long discussions about the
  108 details of the tables with your users, then offer them a feature to
  109 define their own tables, perhaps in the form of changes to the default
  110 tables listed below (or give at least a pointer in the source code of
  111 public domain software, where user-defined tables might be modified for
  112 local needs).
  113 
  114 Users should know if the text they read has been converted from the
  115 original Latin 1 text, i.e. the conversion should be clearly explained
  116 in the documentation and perhaps again noticed e.g. after the program
  117 starts. Otherwise, the conversion might cause confusion in some cases.
  118 
  119 I collected six tables based on information I received from many USENET
  120 readers from various countries in order to cope with the different
  121 needs of ISO Latin 1 users. In some cases, different replacements might
  122 seem to be more suitable based on the semantics of the characters and I
  123 received may suggestions of this kind, but I decided to selected the
  124 replacements based on the way in which these characters might be used,
  125 which differs often dramatically from the originally intended semantics
  126 of the characters. Consequently, I always preferred graphically similar
  127 replacements, where the field of application of the character did not
  128 seem to be very limited. E.g. it has been suggested to replace the
  129 'left angle quotation mark' [] by '"' instead of '<' in table 1 based
  130 on the common semantic 'quotation mark', but this character is also
  131 often used as a kind of arrow, so a graphically similar replacement was
  132 chosen. Other characters with more limited applications like the
  133 'small German letter sharp s' [] were replaced by the most often used
  134 replacements (e.g. 'ss') instead of graphically more similar characters
  135 like '3' or 'B'.
  136 
  137 First of all, a table with the real characters in the range 160 - 255
  138 (0xa0 - 0xff):
  139 
  140 
  141                                                 
  142                                                 
  143                                                 
  144                                                 
  145                                                 
  146                                                 
  147 
  148 Table 0 is a universal table that is expected to be suitable for many
  149 languages. The letters are simply the ASCII versions without the
  150 diacritics. The fallback substitution character (e.g. '?' or '_') as an
  151 emergency replacement character where no ASCII string is suitable is
  152 used as little as possible, as it carries no information and if we are
  153 pedantic, we have to replace nearly every Latin 1 character over 160 by
  154 question marks etc.
  155 
  156        !   c   ?   ?   Y   |   ?   " (c)   a  <<   -   - (R)   -
  157      +/-   2   3   '   u   P   .   ,   1   o  >> 1/4 1/2 3/4   ?
  158    A   A   A   A   A   A  AE   C   E   E   E   E   I   I   I   I
  159    D   N   O   O   O   O   O   x   O   U   U   U   U   Y  Th  ss
  160    a   a   a   a   a   a  ae   c   e   e   e   e   i   i   i   i
  161    d   n   o   o   o   o   o   :   o   u   u   u   u   y  th   y
  162 
  163 Table 1 replaces Latin 1 characters only with single ASCII characters.
  164 This won't destroy the layout of texts designed to be printed with
  165 monospaced fonts, but the replacements are often not very satisfactory:
  166 
  167        !   c   ?   ?   Y   |   ?   "   c   a   <   -   -   R   -
  168        ?   2   3   '   u   P   .   ,   1   o   >   ?   ?   ?   ?
  169    A   A   A   A   A   A   A   C   E   E   E   E   I   I   I   I
  170    D   N   O   O   O   O   O   x   O   U   U   U   U   Y   T   s
  171    a   a   a   a   a   a   a   c   e   e   e   e   i   i   i   i
  172    d   n   o   o   o   o   o   :   o   u   u   u   u   y   t   y
  173 
  174 In some languages, only removing the diacritics as in table 0 gives
  175 orthographically incorrect and unappropriate results. The following
  176 table 2 might be much more suitable than table 0 in Danish, Dutch,
  177 German, Norwegian and Swedish:
  178 
  179        !   c   ?   ?   Y   |   ?   " (c)   a  <<   -   - (R)   -
  180      +/-   2   3   '   u   P   .   ,   1   o  >> 1/4 1/2 3/4   ?
  181    A   A   A   A  Ae  Aa  AE   C   E   E   E   E   I   I   I   I
  182    D   N   O   O   O   O  Oe   x   Oe  U   U   U  Ue   Y  Th  ss
  183    a   a   a   a  ae  aa  ae   c   e   e   e   e   i   i   i   i
  184    d   n   o   o   o   o  oe   :   oe  u   u   u  ue   y  th  ij
  185 
  186 In some North-European languages, any US-ASCII replacement for the
  187 relevant Latin 1 characters is unacceptable for many people. In these
  188 countries, national variants of 7-bit ISO 646 are still in wide use.
  189 They use consistently some or all of the characters [ ] \ { } | $ and
  190 in one Swedish character set also ~ ^ ` @ for national characters.
  191 Table 3 has been designed for Danish, Finnish, Norwegian and Swedish
  192 users of ISO 646 terminals:
  193 
  194        !   c   ?   $   Y   |   ?   " (c)   a  <<   -   - (R)   -
  195      +/-   2   3   '   u   P   .   ,   1   o  >> 1/4 1/2 3/4   ?
  196    A   A   A   A   [   ]   [   C   E   @   E   E   I   I   I   I
  197    D   N   O   O   O   O   \   x   \   U   U   U   ^   Y  Th  ss
  198    a   a   a   a   {   }   {   c   e   `   e   e   i   i   i   i
  199    d   n   o   o   o   o   |   :   |   u   u   u   ~   y  th   y
  200 
  201 Perhaps some users might prefer for four characters the strings from
  202 table 2 instead of ~ ^ ` @, which are only used in one Swedish
  203 character set. Instead of adding yet another table, take this as a
  204 motivation for allowing user-defined modifications to the tables.
  205 
  206 In RFC 1345, each character from Latin 1 (and from many other character
  207 sets) is assigned a two-character ASCII mnemonic. Table 4 encloses
  208 these mnemonics in brackets. The resulting conversion looses nearly no
  209 information and might be useful in special applications, where the risk
  210 of confusing the reader by the Latin1 to ASCII conversion weights more
  211 than the risk of producing ugly output.
  212 
  213    [NS][!I][Ct][Pd][Cu][Ye][BB][SE][':][Co][-a][<<][NO][--][Rg]['-]
  214    [DG][+-][2S][3S][''][My][PI][.M][',][1S][-o][>>][14][12][34][?I]
  215    [A!][A'][A>][A?][A:][AA][AE][C,][E!][E'][E>][E:][I!][I'][I>][I:]
  216    [D-][N?][O!][O'][O>][O?][O:][*X][O/][U!][U'][U>][U:][Y'][TH][ss]
  217    [a!][a'][a>][a?][a:][aa][ae][c,][e!][e'][e>][e:][i!][i'][i>][i:]
  218    [d-][n?][o!][o'][o>][o?][o:][-:][o/][u!][u'][u>][u:][y'][th][y:]
  219 
  220 The encoding offered by table 4 is still not 100% free of loss of
  221 information. If you see a '[Co]' in the text, then this might have been
  222 both a copyright sign and the string '[Co]'. To avoid this ambiguity,
  223 one might implement the encoding '&Co' for the copyright sign and '&&'
  224 as an escape string for a single '&' as suggested in RFC 1345. This is
  225 not really appropriate in most situations, because even pure ASCII
  226 texts (e.g. C programs) with '&'s will then be changed.
  227 
  228 The following table 5 (based on one suggested by Peter da Silva) is
  229 perhaps more a nice intellectual exercise than something really useful.
  230 It uses the BACKSPACE control character (in the table represented by
  231 '@') in order to get new characters by overstriking ASCII characters.
  232 This gives very poor results for the capital letters on many printers
  233 and is useless on most video terminals, but might be interesting for
  234 languages where often only lowercase characters are used accented (e.g.
  235 French). The quality of the results depends very much on the type of
  236 printer used.
  237 
  238        ! c@| L@- o@X Y@=   |   ?   " (c) a@_  << -@,   - (R)   -
  239      +@_   2   3   '   u   P   .   ,   1 o@_  >> 1/4 1/2 3/4   ?
  240  A@` A@' A@^ A@~ A@"  Aa  AE C@, E@` E@' E@^ E@" I@` I@' I@^ I@"
  241  D@- N@~ O@` O@' O@^ O@~ O@"   x O@/ U@` U@' U@^ U@" Y@'  Th  ss
  242  a@` a@' a@^ a@~ a@"  aa  ae c@, e@` e@' e@^ e@" i@` i@' i@^ i@"
  243  d@- n@~ o@` o@' o@^ o@~ o@" -@: o@/ u@` u@' u@^ u@" y@'  th y@"
  244 
  245 
  246 For the convenience of C programmers, I included the code of these
  247 tables in this text. Just copy the following lines into your software:
  248 
  249 -----------------------------------------------------------------------
  250 /*
  251    Conversion tables for displaying the G1 set (0xa0-0xff) of
  252    ISO Latin 1 (ISO 8859-1) with 7-bit ASCII characters.
  253 
  254    Version 1.1 -- error corrections are welcome
  255 
  256    Table   Purpose
  257      0     universal table for many languages
  258      1     single-spacing universal table
  259      2     table for Danish, Dutch, German, Norwegian and Swedish
  260      3     table for Danish, Finnish, Norwegian and Swedish using
  261            the appropriate ISO 646 variant.
  262      4     table with RFC 1345 codes in brackets
  263      5     table for printers that allow overstriking with backspace
  264 
  265    Markus Kuhn <mskuhn@immd4.informatik.uni-erlangen.de>
  266 */
  267 
  268 #define SUB "?"		/* used if no reasonable ASCII string is possible */
  269 #define ISO_TABLES 6
  270 
  271 static char *iso2asc[ISO_TABLES][96] = {{
  272   " ","!","c",SUB,SUB,"Y","|",SUB,"\"","(c)","a","<<","-","-","(R)","-",
  273   " ","+/-","2","3","'","u","P",".",",","1","o",">>"," 1/4"," 1/2"," 3/4","?",
  274   "A","A","A","A","A","A","AE","C","E","E","E","E","I","I","I","I",
  275   "D","N","O","O","O","O","O","x","O","U","U","U","U","Y","Th","ss",
  276   "a","a","a","a","a","a","ae","c","e","e","e","e","i","i","i","i",
  277   "d","n","o","o","o","o","o",":","o","u","u","u","u","y","th","y"
  278 },{
  279   " ","!","c",SUB,SUB,"Y","|",SUB,"\"","c","a","<","-","-","R","-",
  280   " ",SUB,"2","3","'","u","P",".",",","1","o",">",SUB,SUB,SUB,"?",
  281   "A","A","A","A","A","A","A","C","E","E","E","E","I","I","I","I",
  282   "D","N","O","O","O","O","O","x","O","U","U","U","U","Y","T","s",
  283   "a","a","a","a","a","a","a","c","e","e","e","e","i","i","i","i",
  284   "d","n","o","o","o","o","o",":","o","u","u","u","u","y","t","y"
  285 },{
  286   " ","!","c",SUB,SUB,"Y","|",SUB,"\"","(c)","a","<<","-","-","(R)","-",
  287   " ","+/-","2","3","'","u","P",".",",","1","o",">>"," 1/4"," 1/2"," 3/4","?",
  288   "A","A","A","A","Ae","Aa","AE","C","E","E","E","E","I","I","I","I",
  289   "D","N","O","O","O","O","Oe","x","Oe","U","U","U","Ue","Y","Th","ss",
  290   "a","a","a","a","ae","aa","ae","c","e","e","e","e","i","i","i","i",
  291   "d","n","o","o","o","o","oe",":","oe","u","u","u","ue","y","th","ij"
  292 },{
  293   " ","!","c",SUB,"$","Y","|",SUB,"\"","(c)","a","<<","-","-","(R)","-",
  294   " ","+/-","2","3","'","u","P",".",",","1","o",">>"," 1/4"," 1/2"," 3/4","?",
  295   "A","A","A","A","[","]","[","C","E","@","E","E","I","I","I","I",
  296   "D","N","O","O","O","O","\\","x","\\","U","U","U","^","Y","Th","ss",
  297   "a","a","a","a","{","}","{","c","e","`","e","e","i","i","i","i",
  298   "d","n","o","o","o","o","|",":","|","u","u","u","~","y","th","y"
  299 },{
  300   "[NS]","[!I]","[Ct]","[Pd]","[Cu]","[Ye]","[BB]","[SE]",
  301   "[':]","[Co]","[-a]","[<<]","[NO]","[--]","[Rg]","['-]",
  302   "[DG]","[+-]","[2S]","[3S]","['']","[My]","[PI]","[.M]",
  303   "[',]","[1S]","[-o]","[>>]","[14]","[12]","[34]","[?I]",
  304   "[A!]","[A']","[A>]","[A?]","[A:]","[AA]","[AE]","[C,]",
  305   "[E!]","[E']","[E>]","[E:]","[I!]","[I']","[I>]","[I:]",
  306   "[D-]","[N?]","[O!]","[O']","[O>]","[O?]","[O:]","[*X]",
  307   "[O/]","[U!]","[U']","[U>]","[U:]","[Y']","[TH]","[ss]",
  308   "[a!]","[a']","[a>]","[a?]","[a:]","[aa]","[ae]","[c,]",
  309   "[e!]","[e']","[e>]","[e:]","[i!]","[i']","[i>]","[i:]",
  310   "[d-]","[n?]","[o!]","[o']","[o>]","[o?]","[o:]","[-:]",
  311   "[o/]","[u!]","[u']","[u>]","[u:]","[y']","[th]","[y:]"
  312 },{
  313   " ","!","c\b|","L\b-","o\bX","Y\b=","|",SUB,
  314   "\"","(c)","a\b_","<<","-\b,","-","(R)","-",
  315   " ","+\b_","2","3","'","u","P",".",
  316   ",","1","o\b_",">>"," 1/4"," 1/2"," 3/4","?",
  317   "A\b`","A\b'","A\b^","A\b~","A\b\"","Aa","AE","C\b,",
  318   "E\b`","E\b'","E\b^","E\b\"","I\b`","I\b'","I\b^","I\b\"",
  319   "D\b-","N\b~","O\b`","O\b'","O\b^","O\b~","O\b\"","x",
  320   "O\b/","U\b`","U\b'","U\b^","U\b\"","Y\b'","Th","ss",
  321   "a\b`","a\b'","a\b^","a\b~","a\b\"","aa","ae","c\b,",
  322   "e\b`","e\b'","e\b^","e\b\"","i\b`","i\b'","i\b^","i\b\"",
  323   "d\b-","n\b~","o\b`","o\b'","o\b^","o\b~","o\b\"","-\b:",
  324   "o\b/","u\b`","u\b'","u\b^","u\b\"","y\b'","th","y\b\""
  325 }};
  326 -----------------------------------------------------------------------
  327 
  328 One might perhaps replace the "?" in SUB with "_" or another code that
  329 will be displayed as a blinking question mark, a filled block or
  330 something similar. Then the user will know that the software wants to
  331 tell him/her that it can't display this symbol and that it is not a
  332 question mark. If your software runs on hardware that supports already
  333 another 8-bit characters set (e.g. IBM PC with code page 437, Mac,
  334 etc.), then it might be a much better idea to include only one single
  335 table that uses the supported symbols wherever possible and uses the
  336 strings suggested here only if no better alternative is available. For
  337 instance, a monospaced table for displaying Latin 1 strings on a MS-DOS
  338 computer might look like this:
  339 
  340 -----------------------------------------------------------------------
  341 /* ISO Latin 1 to IBM code page 437 (classic IBM PC character set) */
  342 
  343 unsigned char iso2ibm[96] = {
  344   255,173,155,156,'o',157,'|', 21,'"','c',166,174,170,'-','R','-',
  345   248,241,253,'3', 39,230, 20,249,',','1',167,175,172,171,'?',168,
  346   'A','A','A','A',142,143,146,128,'E',144,'E','E','I','I','I','I',
  347   'D',165,'O','O','O','O',153,'x',237,'U','U','U',154,'Y','T',225,
  348   133,160,131,'a',132,134,145,135,138,130,136,137,141,161,140,139,
  349   'd',164,149,162,147,'o',148,246,237,151,163,150,129,'y','t',152
  350 };
  351 -----------------------------------------------------------------------
  352 
  353 (BTW: IBM code page 850 which is supported by MS-DOS and OS/2 contains
  354 ALL Latin 1 characters, but at other positions, in order to stay
  355 compatible with the old IBM PC character set.)
  356 
  357 The following string conversion routine uses these tables. It may
  358 easily be called before a text received from the network is sent to the
  359 terminal, if the user has selected one of the tables:
  360 
  361 -----------------------------------------------------------------------
  362 /*
  363  *  Transform an 8-bit ISO Latin 1 string iso into a 7-bit ASCII string asc
  364  *  readable on old terminals using conversion table t.
  365  *
  366  *  worst case: strlen(iso) == 4*strlen(asc)
  367  */
  368   void
  369 Latin1toASCII(iso, asc, t)
  370   unsigned char *iso, *asc;
  371   int t;
  372 {
  373   char *p, **tab;
  374 
  375   if (iso==NULL || asc==NULL) return;
  376 
  377   tab = iso2asc[t] - 0xa0;
  378   while (*iso) {
  379     if (*iso > 0x9f) {
  380       p = tab[*(iso++)];
  381       while (*p) *(asc++) = *(p++);
  382     } else {
  383       *(asc++) = *(iso++);
  384     }
  385   }
  386   *asc = 0;
  387 
  388   return;
  389 }
  390 -----------------------------------------------------------------------
  391 
  392 A more sophisticated function that tries to correct column shifts
  393 caused by multi-character replacements by removing SPACEs and TABs
  394 gives often excellent results even in tables. The following function
  395 removes SPACEs and TABs during string conversion only where necessary,
  396 so pure 7-bit strings won't be changed at all. That's been a nice
  397 programming exercise, by the way ... :-)
  398 
  399 -----------------------------------------------------------------------
  400 /*
  401  *  Transform an 8-bit ISO Latin 1 string iso into a 7-bit ASCII string asc
  402  *  readable on old terminals using conversion table t. Remove SPACE and
  403  *  TAB characters where appropriate, in order to preserve the layout
  404  *  of tables, etc. as much as possible.
  405  *
  406  *  worst case: strlen(iso) == 4*strlen(asc)
  407  */
  408   void
  409 CorLatin1toASCII(iso, asc, t)
  410   unsigned char *iso, *asc;
  411   int t;
  412 {
  413   char *p, **tab;
  414   int first;   /* flag for first SPACE/TAB after other characters */
  415   int i, a;    /* column counters in iso and asc */
  416 
  417   /* TABSTOP(x) is the column of the character after the TAB
  418      at column x. First column is 0, of course.              */
  419 # define TABSTOP(x) (((x) - ((x)&7)) + 8)
  420 
  421   if (iso==NULL || asc==NULL) return;
  422 
  423   tab = iso2asc[t] - 0xa0;
  424   first = 1;
  425   i = a = 0;
  426   while (*iso) {
  427     if (*iso > 0x9f) {
  428       p = tab[*(iso++)]; i++;
  429       first = 1;
  430       while (*p) { *(asc++) = *(p++); a++; }
  431     } else {
  432       if (a > i && ((*iso == ' ') || (*iso == '\t'))) {
  433         /* spaces or TABS should be removed */
  434         if (*iso == ' ') {
  435           /* only the first space after a letter must not be removed */
  436           if (first) { *(asc++) = ' '; a++; first = 0; }
  437           i++;
  438         } else {   /* here: *iso == '\t' */
  439           if (a >= TABSTOP(i)) {
  440             /* remove TAB or replace it with SPACE if necessary */
  441             if (first) { *(asc++) = ' '; a++; first = 0; }
  442           } else {
  443             /* TAB will correct the column difference */
  444             *(asc++) = '\t';   /* = *iso */
  445             a = TABSTOP(a);    /* = TABSTOP(i), because i < a < TABSTOP(i) */
  446           }
  447           i = TABSTOP(i);
  448         }
  449         iso++;
  450       } else {
  451         /* just copy the characters and advance the column counters */
  452         if ((*(asc++) = *(iso++)) == '\t') {
  453           a = i = TABSTOP(i);  /* = TABSTOP(a), because here a = i */
  454         } else {
  455           a++; i++;
  456         }
  457         first = 1;
  458       }
  459     }
  460   }
  461   *asc = 0;
  462 
  463   return;
  464 }
  465 -----------------------------------------------------------------------
  466 
  467 As a software author, you might decide to offer one of several levels
  468 of Latin 1 conversion support:
  469 
  470   - The simplest solution is to allow the user to switch between the
  471     real 8-bit representation and the above tables
  472   - Highly recommended is a feature that allows the user to create his
  473     own table. If this is possible based on one or more of the described
  474     default tables, the effort needed for defining a private table will
  475     be reduced drastically. The system administrator should be allowed
  476     to define a default table for his users.
  477   - More comfortable systems might also allow the user to change the
  478     SUB string, to select the style (normal, highlighted, underlined,
  479     blinking, ...) in which the replacement strings are displayed, etc.
  480   - You might even think about possibilities for a user to enter
  481     Latin 1 characters with an old keyboard and editor, a problem
  482     that hasn't been addressed here.
  483 
  484 Many users all over the world are looking forward to your next software
  485 release that will allow them to participate without pain in the world
  486 of 8-bit character communication even before they get modern hardware
  487 with ISO 8859-1 (or even better ISO 10646) character sets.
  488 
  489 Feel free to contact me or experts in USENET group comp.std.internat if
  490 you have any questions about modern character sets. Many thanks to
  491 everyone from comp.std.internat who helped me to improve these tables!
  492 
  493 Markus