Overview
| Artifact ID: | ddb2cc6ea01f4b76b7eea69318af7a9ef78bea0af53e3e85b89aa6ec4d8c3ac1 |
|---|---|
| Ticket: | 27944a3661a5e409dead945dbc8f9e4a50033e62
Taming test utf-6.88 |
| User & Date: | jan.nijtmans on 2020-04-22 22:31:10 |
Changes
- icomment:
Other part of the documentation: <pre> \fBTcl_UtfCharComplete\fR returns 1 if the source UTF-8 string \fIsrc\fR of \fIlength\fR bytes is long enough to be decoded by \fBTcl_UtfToUniChar\fR, or 0 otherwise </pre> The function Tcl_UtfNext() is - and always has been - documented to require the string to be 0-terminated. There never has been a relation between Tcl_UtfCharComplete() and Tcl_UtfNext(). There never has been a loop in Tcl where Tcl_UtfCharComplete() was used for checking whether Tcl_UtfNext() can be called. There was even never documented how many bytes Tcl_UtfNext() is allowed to read in the case of absence of the terminating 0-byte. But since Tcl_UtfPrev() is documented to read a maximum of TCL_UTF_MAX bytes, it's logical to assume the same for Tcl_UtfNext(). This means, care is required replacing Tcl_UtfToUniChar() calls with Tcl_UtfNext(). Tcl_UtfNext() is not simply an optimized replacement for Tcl_UtfToUniChar(). Those two functions behave differently when encountering invalid byte sequences.
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"