|
2018-02-06
| ||
| 19:44 | • Closed ticket [0d902eadd6]: string first cannot assume that Unicode = non-ASCI... artifact: 21040acd6e user: dgp | |
|
2018-02-01
| ||
| 14:38 | • Open ticket [0d902eadd6]. artifact: ca4b232973 user: dgp | |
| 14:30 | • Ticket [0d902eadd6]: 5 changes artifact: 75175b6970 user: dgp | |
|
2017-11-04
| ||
| 00:45 | [0d902eadd6] Ensure that [string first] handles ASCII in Unicode correctly. check-in: 9d3eb006b3 user: dkf tags: trunk | |
| 00:44 | • Closed ticket [0d902eadd6]: string first cannot assume that Unicode = non-ASCI... artifact: c1bb5bf0b5 user: dkf | |
| 00:44 | [0d902eadd6] Ensure that [string first] handles ASCII in Unicode correctly. check-in: 5bc169fef7 user: dkf tags: core-8-branch | |
| 00:41 | • New ticket [0d902eadd6] string first cannot assume that Unicode = non-ASCII</i... artifact: 8b9a866ec2 user: dkf | |
[string first] cannot assume that Unicode = non-ASCII
Closed / Fixed0d902eadd659898069ee5f2fb1c4d0764fdfe57aCreated 9 years agoUpdated 9 years ago
Descriptionhtml2017-11-04 00:41:45
The following code:
set s hello; regexp ll $s m; string first $m $shas a result of -1, which is very surprising. The problem is that regexp uses Tcl_GetRange() on objects with a unicode representation (which regexp needs for its own purposes) and that decides that the best thing is to create a pure unicode object, even though the string is within the ASCII range. Normally that wouldn't matter, but string first (properly TclStringFind()) assumes that that's an impossible situation and jumps merrily to saying that things can't match when that's totally untrue.
This was discovered by Pat Thoyts, and narrowed down to changes in the dgp-string-find branch.
Referenced by2
9d3eb006b3[0d902eadd6] Ensure that [string first] handles ASCII in Unicode correctly. check-in2017-11-04 00:45:275bc169fef7[0d902eadd6] Ensure that [string first] handles ASCII in Unicode correctly. check-in2017-11-04 00:44:14
dkf Closed ticket [0d902eadd6].
[History diff]2017-11-04 00:44:35
dgpplain2018-02-01 14:30:32
The same broken assumption is used in TclStringLast(). % set s hello; regexp ll $s m; string last $m $s -1
dgp Open ticket [0d902eadd6].
[History diff]2018-02-01 14:38:59
dgp Closed ticket [0d902eadd6].
[History diff]2018-02-06 19:44:35
Log in (anonymous is fine) to add a comment.