Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 8b9a866ec239821dcfe7834c1df776fcf0d456116d151ca66f3b476b0a1b8cc8
Ticket: 0d902eadd659898069ee5f2fb1c4d0764fdfe57a
[string first] cannot assume that Unicode = non-ASCII
User & Date: dkf on 2017-11-04 00:41:45
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/html"
  4. comment changed to:
    The following code:
    <pre>
    set s hello; regexp ll $s m; string first $m $s
    </pre>
    has a result of <tt>-1</tt>, which is <i>very</i> surprising. The problem is that <tt>regexp</tt> uses <tt>Tcl_GetRange()</tt> on objects with a unicode representation (which <tt>regexp</tt> needs for its own purposes) and that decides that the best thing is to create a <i>pure</i> unicode object, even though the string is within the ASCII range. Normally that wouldn't matter, but <tt>string first</tt> (properly <tt>TclStringFind()</tt>) assumes that that's an impossible situation and jumps merrily to saying that things can't match when that's totally untrue.
    <p>
    This was discovered by Pat Thoyts, and narrowed down to changes in the <tt>dgp-string-find<tt> branch.
    
  5. foundin changed to: "8.7a1"
  6. is_private changed to: "0"
  7. login: "dkf"
  8. priority changed to: "5 Medium"
  9. resolution changed to: "None"
  10. severity changed to: "Important"
  11. status changed to: "Open"
  12. submitter changed to: "dkf"
  13. subsystem changed to: "11. Conversions from String"
  14. title changed to:
    [string first] cannot assume that Unicode = non-ASCII
    
  15. type changed to: "Bug"