Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: a6ddf627b401fff7652f7d262c59f4faf781fdbc202110c913a398ed40905f99
Ticket: 27944a3661a5e409dead945dbc8f9e4a50033e62
Taming test utf-6.88
User & Date: dgp on 2020-04-22 22:54:11
Changes

  1. icomment:
    
    The implementation of Tcl_UtfNext has ***always*** been
    
    return src + Tcl_UtfToUniChar(src, ...);
    
    Logically any constraint on calling Tcl_UtfToUniChar safely transfers the
    same constraint on calling Tcl_UtfNext() safely.  This implementation has also
    tied together the functionality of the two routines in ways callers may expect.
    
    The original Tcl_UtfNext() documentation did not mention NUL termination.
    That wording was added in checkin
    
    https://core.tcl-lang.org/tcl/info/5154e4e97b390103
    
    at the time when the behavior of Tcl_UtfPrev when passed a trail byte pointer
    was trying to be clarified. [769895]
    
    The original Tcl_UtfNext() docs did state "The caller must not ask for the next
    character after the last character in the string" with no explicit direction on how
    to accomplish that. The reader could reasonably infer the same safety tool
    for Tcl_UtfToUniChar was appropriate for the job.  Someone source diving would
    confirm that inference was correct.
    
    Because of the implementation Tcl_UtfNext() always had, it never had the function
    of acting on trail bytes in the way being sought here. No caller expects it, because
    it's never been that way.  
    
    I'm still willing to follow this exploration trail further to see if there's a reasonable
    way to add this extension of the functionality consistent with the other expectations.
    
  2. login: "dgp"
  3. mimetype: "text/plain"