Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Fix [fconfigure -xchar "\x00 \x00"]

Closed / Accepted1823576fffffffffffffffffffffffffffffffffCreated 19 years agoUpdated 19 years ago
Descriptionplain2007-10-31 16:42:53
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.
stwoplain2007-10-31 23:42:54
File Added - 252213: tclUnixChan.c.patch
dkf Ticket [1823576fff]: 1 change [History diff]2007-11-01 20:48:11
stwoplain2007-11-02 00:38:41
File Deleted - 252213:
stwoplain2007-11-02 00:39:55
File Added - 252417: tclUnixChan.c.patch

Logged In: YES 
user_id=143350
Originator: YES

File Added: tclUnixChan.c.patch
stwoplain2007-11-02 13:30:08
File Deleted - 252417:
stwoplain2007-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
andreas_kupriesplain2007-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 ?
stwoplain2007-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
Log in (anonymous is fine) to add a comment.

Attachments: