Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 1517a02e77625713294cd44377bba809d89a2c6467866b21ab80adc5e5dddadc
Ticket: e617e8a71a00496e9ec682caa1b4e7b5b98c55a7
comparing UTF-16 strings doesn't account for surrogates
User & Date: dgp on 2020-04-30 18:23:27
Changes

  1. icomment:
    
    Work continues on this in a branch, but it's worth noting that matters
    are confusing and difficult because routines and commands that by
    their names and documentation one expects to operate on characters
    are actually operating on UTF-16 code units.  For example, if I don't
    think very carefully about the implementation details, this result is
    surprising to me:
    
    % string compare -length 1 \U10000 \U10001
    0
    
    I think it would be surprising to anyone giving the docs for
    [string compare] a plain reading.
    
    My knee-jerk reaction is to want to revise 8.7 so indexing and lengths
    count characters and not code units, but I know that means a TIP,
    and I have to believe there were strong reasons not to do that in
    the first place.
    
    If we do not attempt something like that, though, we'll need to 
    improve the clarity of a lot of documentation on this point.
    
  2. login: "dgp"
  3. mimetype: "text/plain"