Tcl Source Code

View Ticket
Login
Ticket UUID: 1823576
Title: Fix [fconfigure -xchar "\x00 \x00"]
Type: Patch Version: None
Submitter: stwo Created on: 2007-10-31 16:42:53
Subsystem: 27. Channel Types Assigned To: andreas_kupries
Priority: 9 Immediate Severity:
Status: Closed Last Modified: 2007-11-06 03:08:28
Resolution: Accepted Closed By: andreas_kupries
    Closed on: 2007-11-05 19:37:57
Description:
The values for the -xchar option are taken from the first byte of the passed utf8 strings and not encoding-converted.
If the value of one of the chars is \x00 the encoding will be set to the first byte of Tcl's utf8 sequence for 0 (c0 80), 0xC0.
This patch fixes the problem by adding the necessary conversions.

Patch generated from Tcl8.5b2.
User Comments: stwo added on 2007-11-06 03:08:28:
Logged In: YES 
user_id=143350
Originator: YES

I'm not sure how to add this to the testsuite, but this demonstrates:

Before:
% fconfigure stdout -xchar "\x00 \x00"
% scan [lindex [fconfigure stdout -xchar]] %c
192

After:
% fconfigure stdout -xchar "\x00 \x00"
% scan [lindex [fconfigure stdout -xchar]] %c
0

andreas_kupries added on 2007-11-06 02:37:57:
Logged In: YES 
user_id=75003
Originator: NO

stuart I am accepting this patch. It is now in the HEAD. However, do you have a small test which I can add to the testsuite to demonstrate before/after behaviour ?

stwo added on 2007-11-02 13:33:27:

File Added - 252476: tclUnixChan.c.patch

Logged In: YES 
user_id=143350
Originator: YES

3rd version of the patch.
1st version: ok.
2nd version: better casts.
3rd version: removed unneeded parentheses.
File Added: tclUnixChan.c.patch

stwo added on 2007-11-02 13:30:08:

File Deleted - 252417:

stwo added on 2007-11-02 00:39:55:

File Added - 252417: tclUnixChan.c.patch

Logged In: YES 
user_id=143350
Originator: YES

File Added: tclUnixChan.c.patch

stwo added on 2007-11-02 00:38:41:

File Deleted - 252213:

stwo added on 2007-10-31 23:42:54:

File Added - 252213: tclUnixChan.c.patch

Attachments: