Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2f2280c288ccb31ed87a6deae386529efaf5f83c75a5f682162464984bbeb5db
Ticket: 821620d417f604c40619b610348af78d4c32b855
Different handling of surrogates in utf-8 between Tcl8 and Tcl9
User & Date: jan.nijtmans on 2023-02-26 22:04:44
Changes

  1. assignee changed to: "jan.nijtmans"
  2. icomment:
    This change is explained in TIP #619:
    
    [https://core.tcl-lang.org/tips/doc/trunk/tip/619.md]
    
    Tcl 8.6/8.7 always combines surrogates when it encounters a pair. This is wrong, since it makes the "string length" inconsistant: Glueing two strings together with length 1 (an Upper and a Lower surrogate) results in a new string with length 1. Because Tcl 8.7 uses 3 different internal representations (UTF-8, UTF-16 and UTF-32), and can freely switch between them, there's no way to distinguish a surrogate-pair and a code-point > U+FFFF.
    
    In Tcl 9.0, Surrogates are never joined, so a round-trip between utf-8 -> utf-32 ->utf-8 is losless. That's the intention of TIP #619.
    
    See also [https://core.tcl-lang.org/tcl/tktview?name=0d61d3a2bb], which contains the discussion which lead to exactly this change.
    
  3. login: "jan.nijtmans"
  4. mimetype: "text/x-fossil-wiki"
  5. resolution changed to: "Invalid"
  6. status changed to: "Pending"