Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 624e05176b1333daf70ad46bf53ed5a734b5f7d0481c0fd41fe650b53a034923
Ticket: debd088e48998a758f2927b67c132341954428ea
llength split is different from string length
User & Date: sebres on 2025-03-02 04:24:32
Changes

  1. closer changed to: "nobody"
  2. icomment:
    Please don't close this ticket...<br>
    The things are fundamentally broken and 8.6 needs to be repaired, to handle utf-8 & unicode consistently.
    
    One can decide to split or not to splits surrogates, so `[string length "\ud83e\udd1d"]` may be 2 or it may be 1...<br>
    but important is `[string length "\ud83e\udd1d"] == [llength [split "\ud83e\udd1d" {}]]`.<br>
    Always!
    
    Again, no matter how the decision will be and how it would be fixed (becomes 2 or 1), THEY MUST BE EQUAL. I meant, no matter whether they remains as split-able surrogates or not, but everywhere in the same way, not like now - sometimes yes, sometimes no.
    
    With other words iteration over utf-8 & unicode need to be consistent, especially in dynamic typing lang, moreover in EIAS lang, especially if objects may shimmer, etc.
    
    Just to avoid the mess like this:
    ```
    % set u "\ud83e\udd1d"
    🤝
    % proc test u { string map {1 YES 0 NO} [list [regexp {^.$} $u] [regexp {^..$} $u]] }
    % test $u
    YES NO                 <- 1 char - yes, 2 chars - no
    % string length $u
    2
    % test $u
    NO YES                 <- what?! now vice versa?!
    ```
    and that at script level by simple shimmer from pure utf-8 to string with unicode...<br>
    At C-level it may be much worse, and even pretty vulnerable, with potential to mem-access violation, buffer overrun, segfaults etc (just because one cannot rely on index/length consistence anymore).
    
    To say "chars out of BMP" are not "fully" supported in 8.6 is not quite correct - then why one touches it and rewrites in this broken way at all?<br>
    To say "this was fixed for 9.0" looks also weird to me... because again, then better would be not to touch 8.6 at all (or even revert the things in 8.6 back).
    
  3. login: "sebres"
  4. mimetype: "text/x-markdown"
  5. priority changed to: "7 High"
  6. resolution changed to: "Remind"
  7. severity changed to: "Important"
  8. status changed to: "Open"