Skip to content
Tcl Source Code View Ticket
Login

View Ticket

2024-08-31
07:38
Merge [df6a7e1b38bfae63]: Fix [33f9b4de51], [945d2387d7], [f2e924e881] - encoding character limit bu... check-in: 6711cc9484 user: pooryorick tags: unchained, INCOMPATIBLE_LICENSE
2024-08-23
08:35 • Closed ticket [f2e924e881]: Error reading fixed number of characters from UTF16-... artifact: d9dbee60ce user: apnadkarni
08:32
Fix [33f9b4de51], [945d2387d7], [f2e924e881] - encoding character limit bugs check-in: df6a7e1b38 user: apnadkarni tags: trunk, main
2024-08-22
18:12
Proposed fixes for [945d2387d7], [f2e924e881], [33f9b4de51] check-in: c19b624fa9 user: apnadkarni tags: bug-945d2387d7
2024-08-20
05:37 • New ticket [f2e924e881] Error reading fixed number of characters from UTF16-LE f... artifact: ec7ece5e37 user: apnadkarni

Error reading fixed number of characters from UTF16-LE file containing non-BMP chars

Closed / Fixedf2e924e88181d602cb3b558afba3dc2995ea11a6Created 2 years agoUpdated 2 years ago
Descriptionmarkdown2024-08-20 05:37:13

The following writes emoji to a file in UTF16LE and reads the file back successfully. However, reads of a specific number of characters fails.

% set fd [open utf16.txt wb]
file26c91f9a4c0
% puts -nonewline $fd [encoding convertto utf-16le A\U1F600]
% close $fd
% set fd [open utf16.txt]; fconfigure $fd -encoding utf-16le
% read $fd
A😀
% close $fd
% set fd [open utf16.txt]; fconfigure $fd -encoding utf-16le
% read $fd 2
error reading "file26c937c7370": invalid or incomplete multibyte or wide character
% close $fd

Note the full file read succeeds but the read of two chars fails.

Marked as important because UTF-16LE is native to Win32 API.

Referenced by3
apnadkarniplain2024-08-23 08:35:56
Fixed in [df6a7e1b38].
Log in (anonymous is fine) to add a comment.