home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #30 / NN_1992_30.iso / spool / comp / std / internat / 913 < prev    next >
Encoding:
Internet Message Format  |  1992-12-21  |  8.6 KB

  1. Path: sparky!uunet!zaphod.mps.ohio-state.edu!uwm.edu!linac!att!att!allegra!alice!andrew
  2. From: andrew@alice.att.com (Andrew Hume)
  3. Newsgroups: comp.std.internat
  4. Subject: Re: Data tagging (was: 8-bit representation, plus an X problem)
  5. Summary: systems and standards
  6. Keywords: magic codes, portable data
  7. Message-ID: <24455@alice.att.com>
  8. Date: 20 Dec 92 06:37:55 GMT
  9. Article-I.D.: alice.24455
  10. References: <24426@alice.att.com| <1gpruaINNhfm@frigate.doc.ic.ac.uk> <1gtrpdINN6c4@corax.udac.uu.se>
  11. Organization: AT&T Bell Laboratories, Murray Hill NJ
  12. Lines: 151
  13.  
  14. In article <1gtrpdINN6c4@corax.udac.uu.se>, andersa@Riga.DoCS.UU.SE (Anders Andersson) writes:
  15. > [note Followup-To: comp.std.internat]
  16. > In article <1gt5a2EINNin3@uni-erlangen.de>, unrza3@cd4680fs.rrze.uni-erlangen.de (Markus Kuhn) writes:
  17. > > It should also be noted, that at least one existing OS (Windows NT)
  18. > > uses a 2 byte encoding both internally (e.g. in filenames in Fnodes
  19. > > on the disc) as well as in text files. Text files always begin with
  20. >                           ^^
  21. > > FEFF as a magic code for ISO 10646 textes. This code also indicates,
  22. > > whether it is a littleendian file.
  23. > Is this magic code visible to the user without any special tricks,
  24. > or is it filtered away by the operating system when the file is
  25. > opened for reading?  Suppose I obtain a file, that is labeled as
  26. > containing IS 10646 text, via FTP from a server running Windows NT,
  27. > to a client running a different system--will I then get this 0xFEFF
  28. > magic code (which is meaningless on my system) too, or will I get a
  29. > 'clean' IS 10646 text?
  30. > I remember seeing text files containing an explicit ^Z (0x1A) at
  31. > the end, due to their origin on some home computer where ^Z was the
  32. > ordinary EOF marker, even though I was sitting on a system with
  33. > perfectly functional EOF pointers in the file descriptor blocks...
  34. > I hope the above isn't yet another version of that problem (non-
  35. > standard tags or markers floating around with standards-compliant
  36. > data on systems not understanding them)?
  37. > Alternatively, does this magic code have any chance of becoming
  38. > a standard itself?
  39. > --
  40. > Anders Andersson, Dept. of Computer Systems, Uppsala University
  41.  
  42.  
  43.     This is a quite complicated set of questions that strikes at the
  44. heart of how to handle 10646 text streams and even how to migrate
  45. to where you can handle them.
  46.  
  47.     firstly, we can answer what FEFF is. it is not a character as such
  48. (in fact, it and FFEF are defined as never being characters). the meaning,
  49. defined in 10646, is that the following byte stream *should* be in MSB first
  50. order (FFEF indicating LSB first). note that this is informative and
  51. not normative.
  52.  
  53.     how would you use such a thing? good question. what i tell you now
  54. is not in any standard. there is a convention, proposed by the unicoders,
  55. that text streams have a FEFF as the first 16 bits that is not part of
  56. the text stream; the FEFF serves as a byte-order indicator. (it has never
  57. been clear to me how FEFFs after the first 16 bits are handled.) so, for
  58. a program like cat would strip the FEFFs from all its inputs, swab'ing
  59. those inputs who were FFEFs, and emitting one FEFF before the catenation
  60. of the (processed) inputs.
  61.  
  62.     can we answer the question yet of what happens to an ftp'ed file?
  63. not yet. before we can do that, we need to know a little about your system.
  64. one way of classifying systems is whether or not files are typed.
  65.  
  66.     in unix (and plan 9), files are not typed from the system
  67. point of view. there are certainly files which are typed at the application
  68. level; archives, exectuables. these files typically need to be massaged
  69. by specific sets of utilities. for example, the tools for manipulating
  70. archives are ar, ranlib, and ld. however, it is legal to cat archives,
  71. and copy them with cp, and so on and we know this in advance, because
  72. the system just views these files as byte streams.
  73.  
  74.     in such systems, how do you handle 10646 text? if you insist upon
  75. the FEFF header, then ALL the utilities handling text have to acquire
  76. code to handle the header (and the byte-swabbing that seeing an FFEF implies).
  77. this also means a new cat (otherwise cat'ing together two binary files
  78. might indavertently cause one to be swabbed). it means that all tools
  79. that might handle text have to know when their input is text so that they can
  80. handle it. of course, some folks say that all the files on their system
  81. will have the same byte order and thus the FEFF is not necessary. this
  82. is a plausible position but highly restrictive; it fails utterly in the
  83. presence of networked filesystems.
  84.  
  85.     the other kind of systems support explicit typing of files.
  86. this would allow you to designate a file as being 10646-LSB, S-JIS,
  87. 8859-1, or whatever. such systems will find migration easy but of course,
  88. typed files have problems too: what is the type of a pipeline?
  89. what is the type of the output of cat (when its inputs have different types)?
  90. of course, such systems are often small, closed universes (like the world
  91. according to Word) with carefully planned allowable user actions.
  92. such system are limited but can be really smooth to the user.
  93.  
  94.     there is also the problem of migration; how the hell do you
  95. migrate to this new scheme? it amounts to being able to guess what the
  96. text files are on your system and converting them (to 16bit chars or whatever).
  97.  
  98.     the next system issue is deciding on the representation of
  99. text streams throughout the system. for example, as the body of a file?
  100. as an argument to a system call? as an argument to a library call?
  101. as text for display by the user's display? these are not necessarily
  102. the same. for example, the system might allow either byte sex as the
  103. contents of a file but insist on one byte order (and thus no FEFF)
  104. for library and system calls and display (this example has difficulties
  105. if your display is actually networked to another architecture).
  106. by and large, this becomes a mess of interfaces each trying to guess
  107. how other parts need their text streams.
  108.  
  109.     for mostly these reasons, Plan 9 chose a byte-stream encoding
  110. (initially UTF-1 and then UTF-2) and applied it uniformly according
  111. to a single rule: all byte streams interpreted as characters shall
  112. be interpreted as a sequence of 10646 characters encoded as UTF-2.
  113. this applies everywhere: it applies to the kernel and file server,
  114. it applies to the window system and the user's display, it applies
  115. to names in archives and tar files. and best of all, the existing
  116. system and its text is, because we were an ascii site, already
  117. correctly encoded. (actually, we were a Latin-1 system, but we were
  118. willing to make user's convert latin-1 text to the new format.)
  119.  
  120.     normally, such a solution
  121. requires everything entering/leaving the plan 9 universe be converted.
  122. however as the encoding we use is backward compatible with ASCII,
  123. no conversion needs be done for the only important case (text files on
  124. networked filesystems). it also has the advantage that all programs
  125. can display text uniformly; users don't have to write S-JIS editors
  126. because the regular editor (sam or ed) edits kana/kanji just fine.
  127. all the conversion effort can be, and is, confined to one place
  128. (a program called tcs [translate character sets]). the hope is
  129. that is most cases, this conversion can happen automatically
  130. (which is how this stream arose originally; the case of mail
  131. and news should be easy to make happen).
  132.  
  133.     to finally come back to the original question, one would presume
  134. that ftp simply transfers files without diddling them and as such,
  135. if the original had an FEFF, then the result would as well. a more
  136. agressive ftp might convert to local format, inserting the FEFF as necessary,
  137. but this would require another mode (don't want compress'ed files
  138. swabbed, do we?) for transmission.
  139.  
  140.     finally, you must understand that 10646 doesn't mandate
  141. solutions to any of these issues. it has accomplished an admirable job
  142. in that we can now unamibguously refer to explicit characters.
  143. however, as i hope i have shown above, there is much more to the job
  144. of converting and migrating to a ``10646 system''. i believe plan 9
  145. was the first such system, mainly because we had the will and the source
  146. (and rather less of it than most systems). there are still lingering
  147. problems, mainly talking to other systems (for example, most of
  148. the printers we use are postscript printers driven from unix machines;
  149. it has been a long and tedious process to get them to understand 10646
  150. characters), but on the whole, within Plan 9, it just works.
  151.  
  152.     i believe these system (design and migration) issues have been
  153. essentially ignored in all the work and fuss on unicode/10646.
  154. i know that deep within unicode and in places like X/Open, there are
  155. efforts to develop support libraries for wide characters but this simply
  156. ignores the system issues.
  157.  
  158.  
  159.             andrew hume
  160.