Tk Library Source Code

View Ticket
Login
Ticket UUID: 806420
Title: comm uses wrong fconfigure options
Type: Bug Version: None
Submitter: mic42 Created on: 2003-09-15 09:59:27
Subsystem: comm Assigned To: hobbs
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2003-10-22 05:50:07
Resolution: Fixed Closed By: hobbs
    Closed on: 2003-10-21 22:50:07
Description:
Comm loses unicode chars on the way.

This originates from a bug in the configuration of the
channel, it is configured with:

proc ::comm::commNewConn {chan id fid} {
    ...
    fconfigure $fid -trans binary -blocking 0
    ...
}

which kills all unicode chars above ascii, as encoding
is set to binary, which strips high bytes from unicode
chars.

This should really be:
    fconfigure $fid -translation lf -encoding utf-8
-blocking 0
User Comments: hobbs added on 2003-10-22 05:50:07:
Logged In: YES 
user_id=72656

schlenk correctly noted that -trans binary appears to be 
stripping, not converting the unicode.  :(
I've made the change for comm to use utf-8 by default, 
which is mostly compatible with the previous semi-broken 
stuff, and going forward is fully i18n happy.

hobbs added on 2003-10-22 04:52:34:
Logged In: YES 
user_id=72656

-translation binary should not lose any data - it will treat it all 
as 8-bit clean data.  You just have to interpret on the 
receiving end ... perhaps comm requires some sort of 
encoding command.  The reason that binary is used currently 
is that this is compatible with the use of comm by a Tcl < 8.1 
interpreter.  Forcing a different encoding now would also 
possibly be an incompatible comm version change.

zoro2 added on 2003-09-15 21:27:33:
Logged In: YES 
user_id=191529

This patch is correct, except that 'identity' encoding
should be used instead, so that non-utf-escaped binary
strings (which shouldn't happen, but should be considered
for some pre-unicode packages).