|
2022-01-16
| ||
| 09:46 | • Closed ticket [6474fbd934]: Tcl 8.7a5: why utf-8 is different? plus 4 other ... artifact: 0a20eddb96 user: jan.nijtmans | |
|
2022-01-15
| ||
| 17:02 | Fix [6474fbd934]: Tcl 8.7a5: why utf-8 is different? check-in: 3f25428a3f user: jan.nijtmans tags: core-8-branch | |
|
2022-01-14
| ||
| 22:39 | • Pending ticket [6474fbd934]: Tcl 8.7a5: why utf-8 is different? plus 5 other... artifact: 7de032bd99 user: jan.nijtmans | |
| 22:34 | Proposed fix for [6474fbd934]: Tcl 8.7a5: why utf-8 is different? closed check-in: c4a89ec75d user: jan.nijtmans tags: bug-6474fbd934 | |
| 09:05 | • New ticket [6474fbd934] Tcl 8.7a5: why utf-8 is different?. artifact: 1ed05bb442 user: petasis | |
Tcl 8.7a5: why utf-8 is different?
Closed / Fixed6474fbd934378bb2a9d505f2799f9787a10a3f09Created 5 years agoUpdated 5 years ago
Descriptionplain2022-01-14 09:05:51
Hi all, I observe a difference in converting strings to utf-8 between Tcl 8.6/8.7a1 and 8.7a5. In Tcl 8.6 I get: binary scan [encoding convertto utf-8 \uD800] H* hex; puts $hex > efbfbd which seems the correct utf-8 encoding. However, in Tcl 8.7a5 I get: binary scan [encoding convertto utf-8 \uD800] H* hex; puts $hex > eda080 What is the reason for this difference? Shouldn't the utf-8 bytes be the same, no matter what internal representation for strings is used by Tcl? I know that this is invalid input (and only half of a "character"), but in my view what tcl 8.6 returns makes much more sense, as there is a (very) limited usage. The behaviour in 8.7 returns a character, hiding the problem in the input... George
Referenced by2
3f25428a3fFix [6474fbd934]: Tcl 8.7a5: why utf-8 is different? check-in2022-01-15 17:02:29c4a89ec75dProposed fix for [6474fbd934]: Tcl 8.7a5: why utf-8 is different? check-in2022-01-14 22:34:06
jan.nijtmanswiki2022-01-14 22:39:45
Proposed fix [here].
This was - indeed - an early attempt to solve a problem in Tcl, which could cause Tcl to generate invalid UTF-8. Since then, a new idea to solve this arised: TIP #601. So I agree to revert this to the Tcl 8.6 behavior. Starting with Tcl 9.0, this situation should (IMHO) throw an exception (by default).
jan.nijtmans Closed ticket [6474fbd934].
[History diff]2022-01-16 09:46:38
Log in (anonymous is fine) to add a comment.