| Ticket UUID: | b69e00ecf6b9c3ab7e6a99d731a6f22d82e7b7d8 | ||
| Title: | Tcl does not raise an error even when it detects an invalid internal UTF-8 sequence | ||
| Type: | Bug | Created on: | 2025-07-16 06:40:21 |
| Submitter: | apnadkarni | Assigned to: | nobody |
| Subsystem: | 11. Conversions from String | Severity: | Important |
| Priority: | 5 Medium | Last modified: | 2025-07-16 06:40:41 |
| Status: | Open | Closed by: | nobody |
| Resolution: | None | Closed on: | |
| Version: | |||
| Description: | ||||
|
Logging this bug as a reminder to revisit Tcl internal handling of invalid strings. As an example of the broader issue, invalid UTF-8 sequences raise an error on
Both the above are actually UTF8->UTF8 conversions, the first converting from standard UTF-8 to Tcl's internal UTF-8 and the latter in the other direction. (The
In general this behavior seems to be by design as internally there are many places where Tcl converts invalid sequences without raising an error but instead either mapping to some character, either U+FFFD, or cp1252 equivalent or assuming iso8859-1 encoding (there is no consistency in this mapping either!). While this situation only occurs when invalid data is passed in via
This is a reminder to revisit this rather thorny issue of handling invalid internal string values. | ||||
