Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2026-05-27
03:39 • Closed ticket [165b103962]: Error message of "TclGetBytesFromObj" may ... artifact: 3046843c89 user: apnadkarni
03:38
Merge 9.0 - Fix [165b1039] - error message for byte arrays check-in: 0d78cb4125 user: apnadkarni tags: trunk, main
03:35
Fix [165b1039] - error message for byte arrays check-in: fbd094029a user: apnadkarni tags: core-9-0-branch
2026-05-26
08:34 • Ticket [165b103962] Error message of "TclGetBytesFromObj" may include ... artifact: 1b4714b3df user: oehhar
2026-05-25
23:24
Bug [165b103962] - do not print character on byte array error. check-in: 9083399603 user: apnadkarni tags: bug-165b1039
16:38 • Ticket [165b103962] Error message of "TclGetBytesFromObj" may include ... artifact: db2a98bb6c user: apnadkarni
2022-03-15
10:50 • New ticket [165b103962]. artifact: 19ffdb7432 user: oehhar

Error message of "TclGetBytesFromObj" may include arbitrary character

Closed / Fixed165b10396273d81c7bcef3e564537a39eba7404bCreated 5 years agoUpdated 190 days ago
Descriptionwiki2022-03-15 10:50:56
Hi Jan, Don, thank you for your work on propper bytearrays. This is great work.

May I ask for a change? Please make sure, that error messages only contain printable ASCII. You never know, what happens with error messages. They are written to the console, logs or data bases and are set over the network. Thus, arbitrary contents may lead to strange bugs. You never know the encoding of the target.

Here is an example of current main branch, where *TclGetBytesFromObj* is called with the last argument of the following command. *TclGetBytesFromObj* generates this error message:

% encoding convertfrom iso8859-1 \u0141
expected byte sequence but character 0 was 'Ł' (U+000141)

See the "Ł" in the error message. I don't want to imagine what happens, if a non printable character is outputted.

Thank you and take care, Harald

Referenced by1
apnadkarnimarkdown2026-05-25 16:38:24

I agree with Harald. On encoding errors, I don't think we should attempt to print the failing bytes as characters. Question is what the message wording should be. Is the below acceptable to all. It would be nice to agree before changing the strings in the test cases!

% encoding convertfrom iso8859-1 \u0141
expected code point values below 0xff but value at byte offset 0 was 0x141
oehharwiki2026-05-26 08:34:54

Agree Thanks for caring, Harald

apnadkarniplain2026-05-27 03:39:14
Fixed in [fbd094029a]
Log in (anonymous is fine) to add a comment.