Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 44cd00730811d5120952dd345400a5c984992e29f39e9598e075d622f33fd5fd
Ticket: 27944a3661a5e409dead945dbc8f9e4a50033e62
Taming test utf-6.88
User & Date: jan.nijtmans on 2020-04-19 10:02:40
Changes

  1. icomment:
    Here is the documentation from Utf.n:
    <pre>
    Given \fIsrc\fR, a pointer to some location in a UTF-8 string,
    \fBTcl_UtfNext\fR returns a pointer to the next UTF-8 character in the
    string.  The caller must not ask for the next character after the last
    character in the string if the string is not terminated by a null
    character.
    </pre>
    
    The wording in the source code of tclUtf.c is less clear, so I propose
    to copy the wording from Utf.n to tclUtf.c In the given example, the \xA0 byte is a valid 'some location in a UTF-8 string'. The next character starts at index 3, so that should be the answer.
    
    Proposed fix in commit: [74d3f929c887755e].  I leave it to you to implement the same in the optimized implementation you are working on.
    
    This is a long-standing bug. Since Tcl never calls Tcl_UtfNext() to random locations in a string, there were never test-cases covering this situation. Now there are: Thanks for that, Don!
    
  2. login: "jan.nijtmans"
  3. mimetype: "text/x-fossil-wiki"