Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: ed480bcbef7efecb1b73686fbfc3de3cf393f80d
Ticket: af0f23b62fcb3e5d828c78e8b02f19114cfa9d48
Tcl_UniCharToUtf() not conform to documentation
User & Date: gcramer on 2017-05-03 08:57:13
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/html"
  4. comment changed to:
    The documentation of Tcl_UniCharToUtf() says:
    
    <verbatim>
    Tcl_UniCharToUtf stores the Tcl_UniChar ch as a UTF-8 string in starting at buf. The return value is the number of bytes stored in buf.
    </verbatim>
    
    <p>
    But Tcl_UniCharToUtf(0,buf) stores "\300\200" into buf, this is not an UTF-8 string, it's an anomaly (belongs to MUTF-8), not conform to UTF-8 standard. Either Tcl_UniCharToUtf is erroneous, or the documentation is incomplete.
    
    <p>
    This is a severe problem. If anybody is using this function to store an UTF-8 string in a database, trusting the documentation, it might happen that the database become damaged, because in general no other (properly implemented) UTF-8 based tool is interpreting the anomaly "\300\200". Please note that UTF-8 is not MUTF-8.
    
    <p>
    BTW: The formats MUTF-8, WTF-8, and CESU-8 are not really encoding formats. They are more or less invented for designating results of erroneous UTF-8 implementations, especially the thing with surrogates, a result of an accident (programming error). It's embarrassing if corporates like Microsoft, Sun, et al, are declaring these ill-formed UTF-8 encodings as "UTF-8". Free software should not follow the way of corporates. Here it means: if the result of Unicode point zero is not UTF-8 (<a href="https://tools.ietf.org/html/rfc3629">RFC3629</a>), then this should be explicitly documented.
    
  5. foundin changed to: "8.6/8.7"
  6. is_private changed to: "0"
  7. login: "gcramer"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "9b7155594aadef44d10a978838b8fe108cdafdd1"
  10. resolution changed to: "None"
  11. severity changed to: "Severe"
  12. status changed to: "Open"
  13. submitter changed to: "gcramer"
  14. subsystem changed to: "44. UTF-8 Strings"
  15. title changed to: "Tcl_UniCharToUtf() not conform to documentation"
  16. type changed to: "Bug"