Artifacts Associated With Ticket 6474fbd934
Ticket change [1ed05bb442] (rid 197068) by petasis on 2022-01-14 09:05:51:
- assignee initialized to: "nobody"
- closer initialized to: "nobody"
- cmimetype initialized to: "text/plain"
- comment initialized to:
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
- foundin initialized to: "8.7a5"
- is_private initialized to: "0"
- login: "petasis"
- priority initialized to: "5 Medium"
- private_contact initialized to: "3cb4dabca0e1e7b9d560b2ca060abb67f2a97f23"
- resolution initialized to: "None"
- severity initialized to: "Minor"
- status initialized to: "Open"
- submitter initialized to: "petasis"
- subsystem initialized to: "44. UTF-8 Strings"
- title initialized to: "Tcl 8.7a5: why utf-8 is different?"
- type initialized to: "Bug"
Ticket change [7de032bd99] (rid 197089) by jan.nijtmans on 2022-01-14 22:39:45:
- assignee changed to: "jan.nijtmans"
- icomment:
Proposed fix [c4a89ec75de1ded1|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: [https://core.tcl-lang.org/tips/doc/trunk/tip/601.md|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).
- login: "jan.nijtmans"
- mimetype: "text/x-fossil-wiki"
- resolution changed to: "Fixed"
- status changed to: "Pending"
Ticket change [0a20eddb96] (rid 197104) by jan.nijtmans on 2022-01-16 09:46:38:
- closedate changed to: "2459595.90738943"
- closer changed to: "jan.nijtmans"
- login: "jan.nijtmans"
- mimetype: "text/plain"
- status changed to: "Closed"