Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: f67080ea874f52396ac35836622c2f1d73731132
Ticket: 769812ffffffffffffffffffffffffffffffffff
Tcl_NumUtfChars not as documented
User & Date: dgp on 2003-07-11 19:20:52
Changes

  1. assignee changed to: "nijtmans"
  2. cmimetype changed to: "text/plain"
  3. comment changed to:
    
    Documentation for Tcl_NumUtfChars says:
    
         Tcl_NumUtfChars corresponds to strlen for UTF-8
    strings.  It
         returns  the  number of Tcl_UniChars that are
    represented by
         the UTF-8 string src.  The length of the  source 
    string  is
         len  bytes.   If the length is negative, all bytes
    up to the
         first NULL byte are used.
    
    However, when length is negative, the routine
    does not stop at the first NULL byte.  It stops
    after the first UTF sequence that converts to
    the null character, notably \xC0\x80
    
    So, it seems that
    
        Tcl_NumUtfChars("\300\200\000", -1)
    
    will return 0, when it should return 1.
    
    It appears that changing line 506 of revision
    1.31 of generic/tclUtf.c from
    
        if (ch == '\0') {
    
    to
    
        if (str[-1] == '\0') {
    
    would correct the error.
    
  4. foundin changed to: "obsolete: 8.4.3"
  5. priority changed to: "5 Medium"
  6. resolution changed to: "None"
  7. status changed to: "Open"
  8. submitter changed to: "dgp"
  9. subsystem changed to: "44. UTF-8 Strings"
  10. title changed to: "Tcl_NumUtfChars not as documented"
  11. type changed to: "Bug"