Tcl Source Code

View Ticket
Login
Ticket UUID: 4b80f92abd6c4067859f325ec77b5ca1a796a2a8
Title: cannot transform using unicode (maybe)
Type: Bug Created on: 2024-01-17 07:31:47
Submitter: anonymous Assigned to: nobody
Subsystem: 26. Channel Transforms Severity: Minor
Priority: 5 Medium Last modified: 2024-01-17 07:31:47
Status: Open Closed by: nobody
Resolution: None Closed on:
Version: 8.6
Description:
First off, this may or may not be a bug. I just don't know enough about channel transforms to tell. I may be just coding it incorrectly.

The problem is I can't get it to handle unicode. There is a file on the wiki, here,

https://wiki.tcl-lang.org/page/console+for+Unix

I am trying to get this to work on Linux and have written TIP 561 for it. I thought the code was working and only needed to be supported by the core group. However, the code does not work when one does a puts "\uxxxx" but instead outputs 3 garbage characters. I thought the problem was in the initialize fconfigure, that was doing the line below that I've commented out and replaced with the utf-8 encoding:

        proc initialize {what x mode}    {
#           fconfigure $what -buffering none -translation  binary
            fconfigure $what -buffering none -encoding utf-8
            info procs
        }

Could someone knowledgeable about this take a look. This code is normally sourced as in,

> wish8.6 (can't run as is on 9.0)
% source console.tcl
% puts "\u277D"

This should output a unicode 8-ball.

Thanks, if this is a bug and can be fixed, it would really help. If it's an error in my code, or just something the channel transforms can't handle, I'd appreciate knowing.

Note, this code as it is will fail on 9.0 totally which I can fix easily by changing some of the private calls to ::tk::ConsoleOutput etc.

So if you test it, please do so on tcl/tk 8.6 not 9.0.