|
2003-10-08
| ||
| 21:28 | • Ticket [769812ffff] Tcl_NumUtfChars not as documented status still Closed wi... artifact: 2c4e0c863f user: dkf | |
| 21:28 | • Ticket [769812ffff]: 5 changes artifact: d69da8cb1d user: dkf | |
| 21:28 | • Closed ticket [769812ffff]. artifact: 3a61f4ef48 user: dkf | |
| 20:55 | • Ticket [769812ffff]: 4 changes artifact: db916e4ef6 user: dkf | |
|
2003-10-03
| ||
| 17:15 | • Ticket [769812ffff]: 1 change artifact: 21ecfc9759 user: dkf | |
| 05:29 | • Ticket [769812ffff]: 2 changes artifact: 0d655d56f9 user: dgp | |
|
2003-07-17
| ||
| 12:10 | • Ticket [769812ffff]: 4 changes artifact: 38db16a6de user: dgp | |
| 07:23 | • Ticket [769812ffff]: 4 changes artifact: 7f78743007 user: hobbs | |
|
2003-07-12
| ||
| 04:43 | • Ticket [769812ffff]: 1 change artifact: 4751be0998 user: dgp | |
|
2003-07-11
| ||
| 19:20 | • New ticket [769812ffff]. artifact: f67080ea87 user: dgp | |
Tcl_NumUtfChars not as documented
Closed / Fixed769812ffffffffffffffffffffffffffffffffffCreated 23 years agoUpdated 23 years ago
Descriptionplain2003-07-11 19:20:52
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.
dgp Ticket [769812ffff]: 1 change
[History diff]2003-07-12 04:43:34
hobbsplain2003-07-17 07:23:13
Logged In: YES user_id=72656 are there any tests for this?
dgpplain2003-07-17 12:10:13
Logged In: YES user_id=80530 The example in the report is a demo of the bug. If you're looking for something at the script level, try: package require Tk pack [message .m -text a\u0000b] before fixing the bug, only the character "a" will be displayed. After the bug fix, all three characters are displayed.
dgp Ticket [769812ffff]: 2 changes
[History diff]2003-10-03 05:29:21
dkf Ticket [769812ffff]: 1 change
[History diff]2003-10-03 17:15:13
dkfplain2003-10-08 20:55:35
Logged In: YES user_id=79902 Nothing in the Tcl core exhibits the problem; all uses of Tcl_NumUtfChars also supply the length. Will need to add some extra code to tclTest.c to check this...
dkf Closed ticket [769812ffff].
[History diff]2003-10-08 21:28:09
dkfplain2003-10-08 21:28:10
Logged In: YES user_id=79902 testing for and fixed in head and 8.4 branch
dkf Ticket [769812ffff]: 2 changes
[History diff]2003-10-08 21:28:11
Log in (anonymous is fine) to add a comment.