Skip to content
Tcl Source Code History Of Ticket 578030ffffffffffffffffffffffffffffffffff
Login

History Of Ticket 578030ffffffffffffffffffffffffffffffffff

Artifacts Associated With Ticket 578030ffffffffffffffffffffffffffffffffff

  1. Ticket change [ce0c647e12] (rid 95989) by keithp on 2002-07-06 06:26:41:

    1. assignee initialized to: "nijtmans"
    2. cmimetype initialized to: "text/plain"
    3. comment initialized to:
      Tcl_UniChar is defined as 'unsigned short' which
      restricts the range of Unicode codepoints representable
      in that type to the basic multilingual plane. 
      Additionally, TCL_UTF_MAX is defined as 3 which
      restricts Utf-8 encoded strings to the same range.
      
      Redefining Tcl_UniChar as 'unsigned int' and
      TCL_UTF_MAX as 6 fixes the problem but leaves the
      library incompatible with existing compiled objects.
      
      If binary compatibility is a concern, perhaps the
      internal datatype can be changed and new APIs created
      for the wider set of values leaving the existing
      typedef in place along with the existing interfaces.
      
    4. foundin initialized to: "None"
    5. priority initialized to: "5 Medium"
    6. resolution initialized to: "None"
    7. status initialized to: "Open"
    8. submitter initialized to: "keithp"
    9. subsystem initialized to: "44. UTF-8 Strings"
    10. title initialized to: "Tcl_UniChar is only 16 bits"
    11. type initialized to: "Bug"
  2. Ticket change [f3d3a0e927] (rid 129790) by davygrvy on 2002-07-09 09:51:41:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      This interesting!  Please teach me.
      
      >Tcl_UniChar is defined as 'unsigned short' which 
      >restricts the range of Unicode codepoints representable 
      >in that type to the basic multilingual plane.
      
      In what way does a unicode-16 glyph not fit in 16-bits?  Has 
      the standard changed?  Is there a new design standard we 
      can refer to?  Has the maximum number of bytes to which a 
      utf-8 encoded glyph can be converted to changed as well?  Is 
      Tcl now not standards complient to the unicode spec.. which 
      spec are we now and what spec should we adhere to?
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  3. Ticket change [6cfd061a23] (rid 128620) by dkf on 2002-07-09 16:19:39:

    1. icomment:
      Logged In: YES 
      user_id=79902
      
      IIRC, recent full Unicode standards mandate 32-bit
      characters so that virtually every character ever invented
      by mankind can be represented (though you can bet that
      someone somewhere has a plan to go to 64-bit chars just to
      make sure that extra-terrestrial languages can be
      incorporated into Unicode too!)  Alas, doing this would blow
      the core up even larger than it is now, because there are a
      lot of places where we need fixed-width strings for
      performance reasons (e.g. [string index] on UTF-8 is an O(n)
      operation.)
      
      I somehow doubt that the default config of Tcl is going to
      change from 16-bit chars in the near future; the pay-off is
      just not good enough at the moment.  However, I don't know
      if there's anything much in the core right now (aside from
      the declarations in tcl.h) that assumes a particular
      character size; removing such assumptions is fine to make
      for easier porting to 32-bit chars if/when it becomes a real
      issue.
      
      
    2. login: "dkf"
    3. mimetype: "text/plain"
    4. priority changed to: "1 Zero"
    5. username: "dkf"
  4. Ticket change [8c848947ae] (rid 127753) by davygrvy on 2002-07-09 17:02:47:

    1. icomment:
      Logged In: YES 
      user_id=7549
      
      Right in section 2.2 of the 3.0 spec it states, "Plain unicode 
      text consists of sequences of 16-bit unicode character 
      codes."  And it defines the use of paired codes (none are 
      defined) as an extension, which might be what Keith is 
      refering to.  But it states quite clearly that a unicode 
      character _is_ 16-bits (paired or ain't).
      
      
    2. login: "davygrvy"
    3. mimetype: "text/plain"
    4. username: "davygrvy"
  5. Ticket change [e7423af46b] (rid 104422) by keithp on 2002-07-09 23:15:32:

    1. icomment:
      Logged In: YES 
      user_id=50020
      
      (section 2.2 of Unicode 3.0)
      
      "From the full range of 65536 code values, 63486 are
      available to represent characters with 16-bit code values
      and 2048 code values are available to represent and
      additional 1048544 characters through paired 16-bit code
      values.  These paired code values, or surrogates, will allow
      implementations access to additional characters in the
      future. <em>None of these surrogate pairs has been assigned
      in this version of the standard.</em>"
      
      In version 3.1 and 3.2, there have been significant
      additions to the Unicode standard, including many thousands
      of glyphs outside of what is now called the "basic
      multiligual plane" (BMP).  Several new encodings have been
      defined, the basic 16-bit encoding (UCS2) no longer provides
      the 1-value 1-codepoint mapping which Tcl assumes.
      
      The encoding standard hasn't changed, 3.0 explicitly allows
      for codepoints outside the BMP, what's changed is that there
      are now many defined codepoints in this extended range.
      
      If the intent is to have Tcl support Unicode, then there is
      no question that these additional codepoints must be
      representable, the only question is how to do so.  I
      recommend abandoing the 16 bit encoding as useless; it
      doesn't provide the 1-to-1 mapping which makes constant-time
      indexing trivial, and with surrogates, it requires more
      bytes on average to represent the same data than UTF-8.  You
      may still want to provide the existing 16-bit APIs for some
      level of binary compatibility; those APIs can use surrogates
      to ensure all Unicode codepoints are representable.  APIs
      involving a single codepoint should transition to using a
      new 32-bit datatype.
      
      Constant-time indexing can be implemented using indexes into
      the string, one trivial design would have a 32-bit index for
      each 256 codepoints.  That means locating a codepoint by
      index takes a table lookup to find the offset (constant
      time) and a search through that portion of the data (time
      bounded by a constant).\
      
      UTF-8 now specifies that up to 6 bytes may be required to
      hold a value.  Raising only that limit provides the minimum
      required functionality to use non-BMP glyphs in Tcl; I've
      implemented a modern X backend that can access non-BMP
      glyphs as long as the strings are never represented as
      arrays of Tcl_UniChars inside the interpreter.  The only
      difficulty there was that the internal UTF8 to UCS converter
      is defined to return a Tcl_UniChar and so I had to use a
      separate complete implementation.
      
      
    2. login: "keithp"
    3. mimetype: "text/plain"
    4. username: "keithp"
  6. Ticket change [272dbcfc50] (rid 88477) by hobbs on 2002-07-09 23:48:29:

    1. assignee changed to: "hobbs"
    2. icomment:
      Logged In: YES 
      user_id=72656
      
      I've spoken with Markus Kuhn about this at length when 
      moving to the 3.0 spec (3.[12] were out, but I decided to not 
      go there for now).  Tcl will be staying by default at the 16-bit 
      Tcl_UniChar value with TCL_UTF_MAX == 3.  These are 
      tweakable parameters during compile, and one can specify 
      32-bit Tcl_UniChars and TCL_UTF_MAX == 6.  There is code 
      to support it.
      
      At one point I tested the code to see that it ran through the 
      test suite, which it did with a few minor problems (mostly in 
      test suite assumptions).  However, the 8.x line of Tcl needs 
      to stay with 16-bit UCS2 for binary compatability reasons.
      
      Should we move to UCS4 in Tcl 9?  That is an outstanding 
      question.  Java and Windows both use UCS2 only, X is 
      moving towards full UCS4, but very few apps use it and I'm 
      not even sure the extent to which it will be used 5 or 10 years 
      from now.
      
      I think the best solution would be to introduce UCS2/UCS4 
      conversion functions in the Tcl API.  The reason for this is 
      that, as Keith notes, they are useful now, and will definitely 
      be useful going forward as we are bound to need to deal with 
      UCS2 systems for a long time to come.
      
      
    3. login: "hobbs"
    4. mimetype: "text/plain"
    5. username: "hobbs"
  7. Ticket change [53d04391ae] (rid 93820) by keithp on 2002-07-10 00:41:27:

    1. icomment:
      Logged In: YES 
      user_id=50020
      
      To say that Java and Windows support UCS2 only misstates
      their capabilities.  Both Java and Windows have support for
      surrogates.  That's partially because surrogates are used
      extensively in supporting Chinese, especially the additions
      to Unicode 3.2 from the Hong Kong Supplementary Character
      Set. There is no reason to move the 16-bit APIs to 32-bit
      values; UCS-2 is a perfectly valid Unicode encoding, it just
      must allow for the presense of surrogates and respond
      accordingly.
      
      There are a few Tcl APIs which cannot pass surrogate pairs,
      one of those is the UTF8 to Tcl_UniChar API.
      
      The problem is that UTF-8 doesn't use surrogates, and so
      applications using UTF-8 expect the full range of Unicode
      values to be encoded without them.  Converting from UTF-8 to
      UCS-2 should automatically insert surrogates while
      converting back should replace them with the conjoined value.
      
      Places in the API which deal with a single codepoint in
      relation to its UTF-8 encoding should provide an additional
      32-bit interface.
      
      
    2. login: "keithp"
    3. mimetype: "text/plain"
    4. username: "keithp"
  8. Ticket change [b2e4d8738c] (rid 98417) by hobbs on 2003-07-17 06:20:09:

    1. icomment:
      Logged In: YES 
      user_id=72656
      
      Tcl allows -DTCL_UTF_MAX=6 in CFLAGS for 8.5a and 8.4.4 
      that kicks in an unsigned int Tcl_UniChar.  This isn't a final 
      solution, but half-way there for those who really want it.
      
      
    2. login: "hobbs"
    3. mimetype: "text/plain"
    4. username: "hobbs"
  9. Ticket change [9b273e2481] (rid 111075) by dgp on 2003-11-13 08:57:33:

    1. foundin changed to: "obsolete: 8.4.5"
  10. Ticket change [a4127c1686] (rid 193279) by jan.nijtmans on 2021-04-07 12:44:42:

    1. assignee changed to: "aku"
    2. closedate changed to: "2459312.03104927"
    3. closer changed to: "jan.nijtmans"
    4. comment changed to:
      Tcl_UniChar is defined as 'unsigned short' which
      restricts the range of Unicode codepoints representable
      in that type to the basic multilingual plane. 
      Additionally, TCL_UTF_MAX is defined as 3 which
      restricts Utf-8 encoded strings to the same range.
      
      Redefining Tcl_UniChar as 'unsigned int' and
      TCL_UTF_MAX as 6 fixes the problem but leaves the
      library incompatible with existing compiled objects.
      
      If binary compatibility is a concern, perhaps the
      internal datatype can be changed and new APIs created
      for the wider set of values leaving the existing
      typedef in place along with the existing interfaces.
      
    5. icomment: "Fixed in Tcl 9.0 (not released yet). See TIP #497"
    6. login: "jan.nijtmans"
    7. mimetype: "text/x-fossil-wiki"
    8. resolution changed to: "Fixed"
    9. severity changed to: "Minor"
    10. status changed to: "Closed"