Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 32d14ff5c8e71a6f6556d4ea7fb6fb74f932278809f73a47d4380958076bb67f
Ticket: debd088e48998a758f2927b67c132341954428ea
llength split is different from string length
User & Date: kyak on 2021-02-15 18:56:08
Changes

  1. icomment:
    @jan.nijtmans thanks for your suggestion!
    
    I need those unicode surrogate pairs encoded as a pair of \uXXXX\uXXXX.
    
    So this won't work:
    
    append result [format "\\U%06.6x" $code]
    
    I guess this might work:
    
    #append result [format "\\u%04.4x\\u%04.4x" [expr {(($code-0x10000)>>10)+0xD800}] [expr {(($code-0x10000)&0x3FF)+0xDC00}]]
    
    But I have troubles reading this code :) Better stick to string index, much more readable.
    
    Also, the if {$code > 0xFFFF} branch is basically only there for Tcl 8.6.11 and higher, because older Tcl version won't even hit it. Almost like a #if GCC_VERSION, but for Tcl :)
    
  2. login: "kyak"
  3. mimetype: "text/plain"