Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f2646138857ff5c2fe9e3ff2649f079de2b43953ff50d0bc037c0177d616b578
Ticket: 10c2c17c32ab68e6619f37994b09bbbd06462cd1
UTF-LE32 encoder mapping of surrogates
User & Date: jan.nijtmans on 2023-02-06 21:18:25
Changes

  1. assignee changed to: "jan.nijtmans"
  2. icomment:
    This happens because of the combining behavior of Tcl_UniCharToUtf(), which Tcl 9.0 doesn't do any more by default. Easy to fix. Will do.
    
    You will realize that this is invalid UTF-32. When Tcl_UniCharToUtf() receives an upper surrogate, it will output the first byte of the 4-byte UTF-8 encoding (which is 0xF0, in this case). Feeding Tcl_UniCharToUtf() a lower surrogate will complete the remaining 3 bytes. In case of UTF-32, this combining should not be done, but since Tcl_UniCharToUtf() is used for UTF-16 too, that's where the problem comes from. As you already found out, in Tcl 9.0 this is corrected.
    
  3. login: "jan.nijtmans"
  4. mimetype: "text/x-fossil-wiki"