Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d2393d860e1b4c907e5081e181a474acb4f826d1cafe9af0bcc9b7b7f9729fc8
Ticket: c61818e4c9b710bdf9f947c1a40563aeab85357a
Tcl_UtfPrev flaws
User & Date: sebres on 2020-04-08 12:58:49
Changes

  1. icomment:
    I think my new branch (e. g. [cdffcbaec97b94d2]) restores ultimately the consistency between Tcl_UtfPrev/Tcl_UtfToUniChar and so fixes now all test cases (inclusive utf-7.11.1)...<br/>
    but as for utf-7.11.1 I'm unsure, because correct behavior of Tcl_UtfPrev strictly following Tcl_UtfToUniChar would be to change line 705 [https://core.tcl-lang.org/tcl/artifact?&name=91d7ab8dbaee9821&ln=705|91d7ab8dbaee9821&ln=705] to:
    <code><pre style="padding-left:10pt">
       <b style="color:red">- if (o >= i) {</b>
       <b style="color:green">+ if (o == i) {</b>
    </pre></code>
    but then test utf-7.11.1 would fail with:
    <code><pre style="padding-left:10pt">
       testutfprev A\xE8\xA0\xA0\xA0 3
       ---- Result was:
       2
       ---- Result should have been (exact matching):
       1
       ==== utf-7.11.1 FAILED
    </pre></code>
    The backwards compatibility is one thing, but it could be worse (or even dangerous) if Tcl_UtfPrev would find a char with offset larger than current position (just imagine it would be outside of the end).
    
    ... I'll try yet to remove some optimizations in string trim's (made to circumvent the inconsistency), still unsure it will be possible... and will push it to my branch if it would work.
    
  2. login: "sebres"
  3. mimetype: "text/x-fossil-wiki"