home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1993 #1 / NN_1993_1.iso / spool / comp / unix / bsd / 10985 < prev    next >
Encoding:
Internet Message Format  |  1993-01-07  |  10.7 KB

  1. Xref: sparky comp.unix.bsd:10985 comp.std.internat:1073
  2. Newsgroups: comp.unix.bsd,comp.std.internat
  3. Path: sparky!uunet!spool.mu.edu!agate!dog.ee.lbl.gov!hellgate.utah.edu!fcom.cc.utah.edu!cs.weber.edu!terry
  4. From: terry@cs.weber.edu (A Wizard of Earth C)
  5. Subject: Re: INTERNATIONALIZATION: JAPAN, FAR EAST
  6. Message-ID: <1993Jan7.045612.13244@fcom.cc.utah.edu>
  7. Keywords: Han Kanji Katakana Hirugana ISO10646 Unicode Codepages
  8. Sender: news@fcom.cc.utah.edu
  9. Organization: Weber State University  (Ogden, UT)
  10. References: <2615@titccy.cc.titech.ac.jp> <1993Jan5.090747.29232@fcom.cc.utah.edu> <2628@titccy.cc.titech.ac.jp>
  11. Date: Thu, 7 Jan 93 04:56:12 GMT
  12. Lines: 226
  13.  
  14. Before I proceed, I will [ once again ] remove the "dumb Americans" from my
  15. original topic line.  You and I both know the original attribution was by
  16. way of a query by an American, and was not intended to be reintegrated
  17. into the main thread.
  18.  
  19. In article <2628@titccy.cc.titech.ac.jp> mohta@necom830.cc.titech.ac.jp (Masataka Ohta) writes:
  20. >In article <1993Jan5.090747.29232@fcom.cc.utah.edu>
  21. >    terry@cs.weber.edu (A Wizard of Earth C) writes:
  22. >
  23. >>>>This I don't understand.  The maximum translation table from one 16 bit value
  24. >>>>to another is 16k.
  25. >>>
  26. >>>WHAAAAT? It's 128KB, not 16k.
  27. >>
  28. >>Not true for designated sets, the maximum of which spans a 16K region.
  29. >
  30. >Uuuurrrghhhh!!! Ia Ia!
  31. >
  32. >>128k is only necessary if you are to include translation of all characters;
  33. >>for a translation involving all characters, no spanning set smaller than the
  34. >>full set exists.  Thus a 128k translation table is [almost] never useful
  35. >
  36. >Then, don't say 16 bit. If you say 16 bit, it IS 128K.
  37.  
  38. It is still a translation of one 16 bit value to another.  In is *not* an
  39. *arbitrary* translation we are talking about, since the spanning sets will
  40. be known.
  41.  
  42. >>>>This means 2 16k tables for translation into/out of
  43. >>>>Unicode for Input/Output devices,
  44. >
  45. >>In this particular case, I was thinking an ASCII->Unicode or Unicode->ASCII
  46. >>translation to reduce the storage penalty paid by Western languages for
  47. >
  48. >ASCII <-> Unicode translation does not need any tables. PERIOD.
  49.  
  50. Sorry; I misspoke (mistyped?) here.  I meant to refer to any arbitrary 8-bit
  51. set for which a localization set is available (example: and ISO 8859-x set).
  52. I did not mean to limit the scope of the discussion to ASCII.
  53.  
  54. For any set containing more than 256 characters, raw representation in 16-bit
  55. form is preferrable, as it saves space (an 8-bit representation is not
  56. attainable for such a large glyph-set character set).  This would *not*
  57. result in direct Unicode storage of the large glyph-set characters, since
  58. a language attribution is still necessary for attribution.
  59.  
  60. >>>How can you "cat" two files with different file attributes?
  61. >>
  62. >>By localizing the display output mechanism.
  63. >
  64. >Wow! Apparently he thinks "cat" is a command to display content of
  65. >files. No wonder he think file attributes good.
  66.  
  67. Obviously, by this response, you meant "cat two files to a third file" rather
  68. than what you stated, which would have resulted in the files going to the
  69. screen.  Display device attribution based on supported character sets has
  70. been well discussed, hopefully to both our satisfaction.
  71.  
  72. "cat" command pseudo-code in a language attributed file environment:
  73. [ cat f1 f2 > f3 ]
  74.  
  75.     Shell opens output file (default attribute: Unicode)
  76.     Open first file (attribute: Japanese)
  77.     Read data out (as Unicode data)
  78.     Write Unicode data to stdout
  79.     Write data to stdout
  80.     Close first file
  81.     Open second file (attribute: Japanese)
  82.     Read data out (as Unicode data)
  83.     Write Unicode data to stdout
  84.     Close second file
  85.     Shell closes output file (ala "cat" program exit)
  86.  
  87. Obviously what you are asking is "how do I make two monolingual/bilingual/
  88. multilingual files of different language attribution into a single bilingual/
  89. multilingual file using cat" -- not the question as you have phrased it, nor
  90. as I have answered it, but in the context of the discussion, clearly the
  91. intended tack.  Rather than pretending I don't know what you are getting
  92. at, I will answer the target question to avoid several more cryptic postings
  93. on your part as you slowly work towards the point.
  94.  
  95. The answer is "you don't use 'cat'".  The "cat" command does not deal with
  96. attribution of files because it's redirected output is arbitrarily assigned,
  97. and because of the fact that the input files are processed sequentially.
  98.  
  99. I could argue for open descriptor type attribution and parallelization of
  100. the open mechanism such that all stream types addressed are known to the
  101. "cat" program, since attribution of an inode implies that attribution
  102. can be directly applied to an open in-core file descriptor for an instance
  103. of a pipe on either end and to input and output redirection.  This defeats
  104. the cat program somewhat, and it is still possible to contrive examples
  105. where this would fail:
  106.  
  107.     #
  108.     # Contrived example 1.0
  109.     #
  110.     for i in f1 f2 f3
  111.     do
  112.         cat $i
  113.     done | cat > f4
  114.  
  115. In this case it would not be possible to provide the parallelization I
  116. spoke of above (no doubt you will include this construct in all your
  117. shell scripts from this point on if you rea no further).
  118.  
  119. The correct approach is to note that since Unicode does not provide a
  120. mechanism directly for language attribution, and that file attribution
  121. is only a partial soloution, since it does not deal with non-monolingual
  122. texts.  While this has already been discussed to death, I will answer in
  123. good faith.
  124.  
  125. What this means is that all files which are multilingual in nature require
  126. a compound document architecture.  Whether this is done using "bit stuffing"
  127. (a "magic cookie" which can not occur in normal text files is allocated
  128. a code space in the Unicode character set as a non-spacing language
  129. designation character.  Yes, this means that the data within the files is
  130. stateful.) or by some other mechanism impelementing what the Unicode
  131. committee unfortunately called "Fancy text", or what most people call
  132. "Rich text", or what Adobe calls "Page Description Language" is irrelevant.
  133.  
  134. What this means is that a utility to combine documents (let's call it
  135. "combine") must have the ability to either generate language attributed
  136. files (if the source files are all of a single language attribution) or
  137. our default compound document format (TBD).  This also means that the
  138. only difference between its operation and that of "cat" is that it must
  139. be unable to accept input piped to it, or in any other way in which it
  140. may be contrived to fool such a utility.  The soloution to this may be
  141. documentation of "undefined behaviour" (as ANSI is fond of saying about
  142. the C language) rather than specific limitations on its use.
  143.  
  144. The ability to redirect or pipe output is predicated on the ability to
  145. attribute existing files and/or pipes by language as well; if this is
  146. not allowed, then it would be necessary to specify a direct output file
  147. (most likely as the first argument, like the "tar" command).  Sufficient
  148. definition of "undefined" behaviour could allow us to rename "combine"
  149. back to "cat" if we wished to risk it.
  150.  
  151. Thus, to combine two arbitrary files to produce a third without the user
  152. worrying about language attribution:
  153.  
  154.     combine f1 f2 > f3
  155.  
  156. Attribution of output and clever construction of out output device drivers
  157. would even allow us to switch fonts as dictated by the compound document
  158. architecture controls embedded in the file and/or the attribution of the
  159. file descriptor (the absence of such attribution being an indicator of a
  160. compund document).  Thus a modified "more" could:
  161.  
  162.     more f3
  163.  
  164. successfully, and a modified "lpr" could:
  165.  
  166.     lpr f3
  167.  
  168. successfully.
  169.  
  170. In the case of two monolingual documents of the same attribution, the
  171. standard "cat" command would produce an output file missing language
  172. attribution (unless both files were compound documents, and there was
  173. no aspect of the compounding mechanism causing the files to be unable
  174. to be simply conjoined.
  175.  
  176. A POSSIBLE OPTIMIZATION OF STORAGE FOR SMALL GLYPH-SET LANGUAGES.
  177.  
  178. As a possible optimization to reduce storage costs, we add to the existing
  179. list of potential language attributes for a file, which are:
  180.  
  181. Compound Document
  182. Raw Unicode
  183. <Specific Language>        This may take on many values
  184.  
  185. To these we add:
  186.  
  187. <Language Class>
  188.  
  189. A language class is done by batch reduction of files to reduce storage
  190. costs and to provide attribution, and is done when the system is idle.
  191. For instance, if I have a file which contains US ASCII, French, and German,
  192. a spanning reduction of the language attribute of the file from Raw
  193. Unicode (the result of the standard "cat" output) to a language class of
  194. "ISO Latin-1" is possible, thus reducing storage requirements.  For some
  195. languages, a 100 percent reduction is possible; for others, such as US ASCII
  196. , French, Japanese, or Chinese, it is not.  In these cases, the system locale
  197. can be used to provide a "strong hint".  Ideally, none of this would be
  198. necessary, since we have replace the standard cat, and all non-international
  199. user code will be specific to the locale as long as output of a stream
  200. with multiple potential source languages is restricted.  In a monolingual
  201. environment, this will be possible.  A strict/nonstrict locale switch is
  202. one potential soloution to this problem.  This would cause instant reduction
  203. to the locale language in the strict case.
  204.  
  205. A direct language attribute reduction from Unicode to the language class
  206. ISO Latin-1 will result in a halving of file storage requirements.
  207.  
  208. Note that a reduction from Raw Unicode to Compound Document is possible
  209. base on our "magic cookie" scenerio above.
  210.  
  211. Admittedly, it is possible to misreduce a file if its contents are not
  212. specific to a particular language or language class.  In this case, no
  213. harm is done directly appart from misattribution of the file; the file
  214. can be considered to have been migrated to a slightly slower storage.  Any
  215. additions to the file not fitting into the language class will cause a
  216. remigration back to the Raw Unicode class; hopefully this would be the
  217. minority case, since most utilites will already be internationalized, and
  218. there should be intrinsic internationalization of new utilities.
  219.  
  220. Note that since this is simply a storage compaction optimization, there is
  221. no explict reason that it could not be switchable as to whether or not it
  222. is enforced, at the system administrators discretion.
  223.  
  224.  
  225. Does this answer your "cat" question sufficiently?  The problem seemed to
  226. be that there was not a means around the problem from your point of view.
  227.  
  228.  
  229.                     Terry Lambert
  230.                     terry@icarus.weber.edu
  231.                     terry_lambert@novell.com
  232. ---
  233. Any opinions in this posting are my own and not those of my present
  234. or previous employers.
  235. -- 
  236. -------------------------------------------------------------------------------
  237.                                         "I have an 8 user poetic license" - me
  238.  Get the 386bsd FAQ from agate.berkeley.edu:/pub/386BSD/386bsd-0.1/unofficial
  239. -------------------------------------------------------------------------------
  240.