Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8169e8a54f2500f09bea62d17c97932a6816ccca
Ticket: 411825ffffffffffffffffffffffffffffffffff
Passing list w/UTF-8 from C can fail
User & Date: dgp on 2003-08-26 10:30:59
Changes

  1. icomment:
    Logged In: YES 
    user_id=80530
    
    
    I see the ChangeLog comment from dkf's patch:
    
            * generic/tclUtil.c (TclNeedSpace): Rewrote to be
    UTF-8 aware.
            [Bug 411825, but not that patch which would have
    added extra
            spaces if there was a real non-ASCII space involved. ]
    
    Trouble here is that Tcl_UniCharIsSpace() is the
    wrong test.  It is not equivalent to 
    Tcl_UniCharIsAListElementTerminator()
    which is what we really need to test.  In particular,
    the "non-breaking space" \u00A0 returns true
    from Tcl_UniCharIsSpace(), but is not recognized
    by the list parser in [llength] as a separator of
    list elements.
    
    Looks like the prior fix did correct lots of errors.
    Prior to the fix, every UTF-8 sequence ending
    in the byte \xA0 (or \240) caused trouble with
    TclNeedSpace().  After the fix, only the UTF-8
    sequence \xC2\xA0 is a problem.
    
    Here's an interactive sequence in plain Tcl
    (no C coding required) that demos the remaining
    bug:
    
    % interp create \u00a0
    �
    % interp create [list \u00a0 foo]
    � foo
    % interp alias {} fooset [list \u00a0 foo] set
    fooset
    % interp target {} fooset
    �foo
    % # Just to be really clear...
    % llength [interp target {} fooset]
    1
    
    Assigning to dkf.  If he doesn't
    have it fixed by the time I get
    to work tomorrow, we'll get it
    done then.
    
    
  2. login: "dgp"
  3. mimetype: "text/plain"
  4. username: "dgp"