Skip to content
Tcl Source Code History Of Ticket 5dabd088eecefd81
Login

History Of Ticket 5dabd088eecefd81

Artifacts Associated With Ticket 5dabd088eecefd81

  1. Ticket change [0e6b6b0f72] (rid 182770) by dgp on 2020-04-28 21:46:10:

    1. assignee initialized to: "nobody"
    2. closer initialized to: "nobody"
    3. cmimetype initialized to: "text/plain"
    4. comment initialized to:
      TIP 573 proposes rejection of unpaired surrogates in strings.
      
      This ticket opened to contain comments and discussion on the idea.
      
    5. is_private initialized to: "0"
    6. login: "dgp"
    7. priority initialized to: "5 Medium"
    8. resolution initialized to: "None"
    9. severity initialized to: "Important"
    10. status initialized to: "Open"
    11. submitter initialized to: "dgp"
    12. subsystem initialized to: "- New Builtin Commands"
    13. title initialized to: "TIP 573 discussion"
    14. type initialized to: "RFE"
  2. Ticket change [8f4a58fef0] (rid 182771) by jan.nijtmans on 2020-04-28 21:49:55:

    1. icomment:
      One thing I'm interested in to know: Would this be OK for 8.7?   I think it should, even though it introduces a potential incompatibility:  Anyone using unpaired surrogates should deal with their own consequences.  But if there is a lot of objection, it could be screduled for 9.0 as well
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  3. Ticket change [6cdacb9e76] (rid 182772) by dgp on 2020-04-28 21:58:01:

    1. icomment:
      
      This points the way toward improved Unicode conformance, which is overall a good thing.
      
      I have several thoughts which aren't terribly well organized yet. I'll try to get my 
      thinking straight and clear before I spew too much here.  Most of the issues are
      not about where to go, but how and when and how completely to get there.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  4. Ticket change [28a43fb9cc] (rid 182866) by dgp on 2020-04-30 15:27:56:

    1. icomment:
      
      The trickiest issue here is that Tcl strings have two uses.
      
      First, they are a way to store and process text, and for that purpose
      increased Unicode conformance is the good way to move the
      capabilities of Tcl programming into agreement with the expectations
      of text programming in other languages.
      
      However, Tcl strings are also the common foundation of all values in
      the language.  "Everything is a string".  If we remove some of the
      alphabet we can use to make up those strings, we are removing some
      of the expressible values in that representation set, which can lead
      to trouble.
      
      The same issue came up in the 8.0 -> 8.1 transition.  In 8.0 "Everything
      is a string" meant "Everything is representable as a sequence of bytes",
      and in order to support all values, Tcl 8.0 was written to support strings
      covering that entire set of sequences of any byte value.
      
      When 8.1 came out, the new support for international character sets
      brought with it a new rule that the "string" values were conceptually
      "Any sequence of UCS-2 characters", and when looking at
      (char *) arguments something similar to UTF-8 would be used to
      encode that concept.
      
      This change meant that at least for some commands, script writers
      had to become aware of the distinction between "bytes" and "chars".
      Using the C routines properly demanded even more awareness.
      
      If some user of Tcl 8.0 was accustomed to passing the bytes
      "\xC2\x80" to Tcl and have them reliably treated and preserved
      as a sequence of two things, Tcl 8.1 broke that contract, because
      large parts of Tcl now saw and treated that as U+0080. To make
      up for it, Tcl 8.1 provided bytearrays, so that anyone needing to
      send arbitrary byte sequences into Tcl free from corruption had
      a way to do it.
      
      In parallel with that, I think if we revise our string definition to
      exclude the  UCS-2 characters that are surrogates in UTF-16,
      we likewise need some new facility so that any Tcl users that
      have need to work with UCS-2 arrays can continue to do so.
      
      I think there's at least some reason to believe UCS-2 arrays are
      a concept Tcl programmers need.  If I imagine reading from
      a channel encoded in utf-16, there can be a point where I've
      read the high surrogate but not yet the low surrogate that follows
      it.  In that moment, I need to store in the variable holding "what I've
      read so far from the channel" a value that includes an unpaired
      surrogate.  Just like I can currently use a bytearray to hold an
      incomplete UTF-8 sequence partially read from a binary channel.
      
      This probably means expanding the set of concepts for
      Tcl programming to include bytes, code units, and characters.
      
      I think the historical example of 8.0 -> 8.1 establishes that
      such a change is not absolutely forbidden for 8.7, but it is
      a change of remarkable scale and potential for disruption.
      If we contemplate it, I think we are obligated to supply clear
      migration supports and high quality advice how to navigate it.
      
      Does that make sense?
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  5. Ticket change [ea17a8571d] (rid 182867) by dgp on 2020-04-30 15:37:31:

    1. icomment:
      
      The other thought I have is that if we are aiming for
      increased Unicode conformance, we have other 
      examples to address.  I think at a higher priority.
      
      If we are considering rejecting the byte sequence
      
      0xED 0xA0 0x80
      
      because it is invalid UTF-8 because it represents
      a surrogate, I think we have to consider how we react
      to all the other byte sequences that are also invalid
      in UTF-8.
      
      \xC1
      \xF5
      
      etc.
      
      Unicode recommendations would have us deal
      with all of these as replacement character U+FFFD
      (and then into the disputes about how many :) )
      
      I'd like us to demand valid Modified UTF-8 at least
      in Tcl 9.  At least I think so. Unless exploration of
      the idea reveals a strong reason otherwise.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  6. Ticket change [eb55f551c1] (rid 183109) by dgp on 2020-05-06 20:07:12:

    1. icomment:
      
      Today I encountered what might be another use case to be sure we preserve
      the ability to have values that are arbitrary UCS-2 sequences.  I read that
      on Window systems, the names of filesystem paths are managed as WCHAR
      arrays, which can be any arbitrary sequence of 16-bit values.  We may need
      UCS-2 arrays or the equivalent to handle those without loss or corruption.
      
    2. login: "dgp"
    3. mimetype: "text/plain"
  7. Ticket change [7ca761d1d9] (rid 183448) by jan.nijtmans on 2020-05-18 14:34:20:

    1. icomment:
      > I read that on Window systems, the names of filesystem paths
      
      > are managed as WCHAR arrays, which can be any arbitrary sequence
      
      > of 16-bit values
      
      
      I don't think we need to worry about that much. See second note here:
      [https://docs.microsoft.com/en-us/windows/win32/intl/surrogates-and-supplementary-characters]
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  8. Ticket change [57dc8b5d1b] (rid 183449) by jan.nijtmans on 2020-05-18 14:57:48:

    1. icomment:
      Hm. I read that on Linux system, the names of filesystem paths are managed as char arrays, which can be arbitrary bytes.....
      
      So, on Linux, having set the system encoding as UTF-8, we can have two differenty files in the same directory: One with the byte sequence "\xC2\xA2", another one with the byte sequence "\xA2". Both will be decoded as "ยข" by Tcl. It's exactly the same problem type of problem.
      
    2. login: "jan.nijtmans"
    3. mimetype: "text/x-fossil-wiki"
  9. Ticket change [3877548aea] (rid 199860) by jan.nijtmans on 2022-04-01 09:08:26:

    1. assignee changed to: "jan.nijtmans"
    2. closedate changed to: "2459670.88086154"
    3. closer changed to: "jan.nijtmans"
    4. icomment: "Since TIP #573 is withdrawn, closing."
    5. login: "jan.nijtmans"
    6. mimetype: "text/x-fossil-wiki"
    7. resolution changed to: "Out of Date"
    8. status changed to: "Closed"