home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #19 / NN_1992_19.iso / spool / comp / std / unix / 400 < prev    next >
Encoding:
Internet Message Format  |  1992-08-25  |  6.1 KB

  1. Path: sparky!uunet!uunet!not-for-mail
  2. From: thorinn@diku.dk (Lars Henrik Mathiesen)
  3. Newsgroups: comp.std.unix
  4. Subject: Re: POSIX update
  5. Date: 25 Aug 1992 13:47:22 -0700
  6. Organization: Department of Computer Science, U of Copenhagen
  7. Lines: 115
  8. Sender: sef@ftp.UU.NET
  9. Approved: sef@ftp.uucp (Moderator, Sean Eric Fagan)
  10. Message-ID: <17e68qINNj6j@ftp.UU.NET>
  11. References: <16b9drINNero@ftp.UU.NET> <16i6laINNssj@ftp.UU.NET> <16p6g6INNs4i@ftp.UU.NET> <17bncrINNrpe@ftp.UU.NET>
  12. NNTP-Posting-Host: ftp.uu.net
  13. Keywords: posix, unicode, iso10646
  14. X-Submissions: std-unix@uunet.uu.net
  15.  
  16. Submitted-by: thorinn@diku.dk (Lars Henrik Mathiesen)
  17.  
  18. NOTE: quotes from Doug's article have been included out of sequence.
  19.  
  20. gwyn@smoke.brl.mil (Doug Gwyn) writes:
  21. >In article <16p6g6INNs4i@ftp.UU.NET> thorinn@diku.dk (Lars Henrik Mathiesen) writes:
  22. >>Why is it so bad that Unicode is not like earlier ``extended
  23. >>encodings''? Existing code is a large problem, of course, but what is
  24. >>the problem relative to Standard C itself? The standard provides both
  25. >>wide and multibyte characters, and Unicode happens to fit the former
  26. >>definition instead of the latter.
  27.  
  28. I think I'll answer my own question: The problem is that one cannot
  29. reasonably demand of a vendor that their implementation should allow
  30. the programmer to use wchar_t for Unicode characters.
  31.  
  32. However, my (perhaps misguided) thought was that the problem could be
  33. resolved by the vendors choosing to do precisely that when they want
  34. to add Unicode support to their systems. The rest of the article was
  35. intended to compare programming for Unicode in such an implementation
  36. to programming for some (non-trivial) 8-bit-byte multibyte character
  37. set, and not to imply that such a use would be portable --- but on
  38. rereading I can see that this was less than clear.
  39.  
  40. >And that's the problem.  Unicode appears to be intended for use in
  41. >external text objects, such as disk files.  The only way an
  42. >implementation could simultaneously conform to the C standard and
  43. >to 10646 used for external storage representation would be for it
  44. >to make char (NOT just wchar_t) 16 bits wide.
  45.  
  46. Correct me if I'm wrong, but a C implementation will not become
  47. non-conforming if it documents that |fread| can be used to input
  48. Unicode characters to a wchar_t array, and that library functions such
  49. as |wfgets| exist (declared in a non-standard header, of course).
  50. Programs that exploit this will not be strictly conforming, but
  51. neither will programs that call setlocale(LC_CTYPE, "").
  52.  
  53. (I don't think that 10646 defines what conformance is for programming
  54. languages, but an implementation like this would offer one way of
  55. dealing with it.)
  56.  
  57. >> 3) There is a problem in that the standard defines wide character
  58. >> constants and wide string literals in terms of multibyte
  59. characters.
  60.  
  61. >There is no problem there, and it's not relevant to the issue anyway;
  62. >perhaps you don't understand the intent of this part of the standard.
  63.  
  64. The intent seems to be to enable the programmer to get some constants
  65. ``preconverted'' from multibyte characters into wide characters.
  66.  
  67. It is exactly because this special syntax sugar exists to initialize
  68. wchar_t objects that the type becomes attractive --- any old 16-bit
  69. integral type would do perfectly fine (and be more portable) if you
  70. could live with writing all the constant strings as lists of hex
  71. values.
  72.  
  73. In the normal usage, the wide character set is derived from the
  74. multibyte character set with the sole purpose of one-to-one
  75. convertibility (of characters). But again, a conforming implementation
  76. could use a multibyte character set that was constructed with the sole
  77. purpose of allowing Unicode in wide character constants.
  78. -----------------------------------------------
  79. >[...] it is important for others now trying to work in the same areas
  80. >to (a) fully understand and (b) cooperate with this existing standard
  81. >model.  From what I have seen, ISO 10646 failed on both counts (a)
  82. >and (b), so now we do have a practical programming problem.
  83.  
  84. The problem may be that the Unicode consortium and/or the ISO
  85. committee work under the implicit assumption that their character sets
  86. will _not_ have to coexist with any others; this may even have been a
  87. conscious decision. If all files on your system are Unicode, there's
  88. no problem, of course, because all your compilers work in Unicode too.
  89. -----------------------------------------------
  90. >>If the problem is that POSIX wants to insist on a subset of Standard
  91. >>C, [...]
  92.  
  93. >[...] The prior art here is that which was adopted into the C
  94. >standard, not Unicode which came later.
  95.  
  96. It seems that I was both unclear, and confused on the timing of POSIX
  97. development. I included that paragraph because the thread was named
  98. "POSIX update" (and this is comp.std.unix), and I was not sure if the
  99. percieved problem was with the C standard or with POSIX.
  100.  
  101. The C standard explicitly allows a ``byte'' to be more than eight
  102. bits, and 16-bit Unicode bytes is a very reasonable decision in some
  103. contexts. But it might be that POSIX has additional requirements that
  104. make it impossible for such a system to conform --- and if the POSIX
  105. committee had been aware of Unicode, it would have made sense to avoid
  106. such a conflict.
  107.  
  108. I have since been told, by e-mail, that POSIX has no such conflict,
  109. and that Unicode came later --- and now, from your article, that
  110. Unicode started out differently, anyway.
  111.  
  112. >During the Unicode evolution it was very fluid, for example at one
  113. >point using non-0-valued bytes for the "padding".  When the Unicode
  114. >proposal started heading in a direction that would cause
  115. >incompatibilities with the established multibyte encoding model,
  116. >[...]
  117.  
  118. As far as I can see, padding is not enough. A character set encoding
  119. needs to have some way of shifting in and out of an 8-bit subset if it
  120. is to work as an 8-bit C multibyte encoding. I was not aware that
  121. Unicode, in its early stages, provided such a mechanism. It is true
  122. that the first DIS 10646 (which had nothing to do with Unicode) could
  123. be fitted into the multibyte framework, even though the intention
  124. seems to have been that a file would be either 8-bit or 16-bit, except
  125. perhaps for some annunciators at the start.
  126.  
  127. Lars Mathiesen (U of Copenhagen CS Dep) <thorinn@diku.dk> (Humour NOT marked)
  128.  
  129.  
  130. Volume-Number: Volume 29, Number 12
  131.