Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d6b033a5dc232bdb65a318b7cc81f2a2d9d70edd9b410bad7d35a164af520162
Ticket: 0d61d3a2bb905178694d6cde8147039974600274
Tcl interprets two adjacent surrogate code points as a character encoded using UTF-16
User & Date: pooryorick on 2021-03-10 21:40:48
Changes

  1. closedate changed to: "2459284.40333823"
  2. closer changed to: "pooryorick"
  3. icomment:
    TIP 597 is more like it!  Considering a Unicode string to be a sequence of code
    points rather than a sequence of characters, and allowing a string to be
    composed of any sequence of code points at all is the perfect solution to this
    issue.  Tcl can leave it to the various transcoders to decide which code point
    sequences are allowed in the target encoding.  But since any sequence of
    Unicode code points is in fact Unicode, <code>string is Unicode</code> is a
    misnomer.  <code>string is character</code> would be a more accurate name.
    Perhaps there could also be a <code>string is assigned</code> and even a
    <code>string is surrogate</code>.
    
    In my opinion, rather than silently replacing code points it can't work
    with, an encoder should produce an error if it is handed a string it can't
    properly encode.  The current practice of replacing invalid characters has
    caused all sorts of trouble, and the sooner it is eliminated, the better.
    Replacement can be implented at the script level if needed, but if it's
    baked in, there's no escaping it.
    
    Thanks, Jan, for the revisiting the design and finding a better approach, and
    thanks, Don, for taking time to articulate the alternatives.
    
  4. login: "pooryorick"
  5. mimetype: "text/x-fossil-wiki"