home *** CD-ROM | disk | FTP | other *** search
/ Usenet 1994 January / usenetsourcesnewsgroupsinfomagicjanuary1994.iso / sources / std_unix / volume.29 / text0011.txt < prev    next >
Encoding:
Text File  |  1992-12-26  |  5.6 KB  |  117 lines

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