|
From: <apn...@ya...> - 2025-11-02 08:07:11
|
Eric,
I believe (but not completely sure) that the bytes are not always UTF-8 encoded but rather encoded as per the channel’s configuration. So decoding should probably be done using whatever encoding has been configured for the channel.
/Ashok
From: EricT <tw...@gm...>
Sent: Saturday, November 1, 2025 3:14 AM
To: Tcl...@li...
Subject: [TCLCORE] TIP 561 - Working console.tcl implementation with channel transforms
Hello Tcl Core Team,
I've successfully resolved the Unicode handling issues with the channel transform
implementation for TIP 561 (Console command for Linux/Unix).
The key fix was recognizing that channel transforms receive UTF-8 encoded bytes,
which need to be decoded back to Unicode strings before passing to the Tk console
widget:
set data [encoding convertfrom utf-8 $data]
This eliminates the need for the pre-8.6 puts wrapper method, providing a clean,
API-based solution using TIP#230 channel transforms.
The working implementation is available at:
https://github.com/rocketship88/tcl-console-unix
Since I don't have permissions to update the TIP or its branch, could someone
kindly review the code and update console.tcl in the TIP 561 repository if it
looks acceptable?
The implementation has been tested on Pop!_OS Linux with proper Unicode display,
console cleanup, and output restoration to the terminal.
Thank you,
Eric
|