|
2013-05-07
| ||
| 16:11 | • Closed ticket [3612458fff]: "fconfigure stdout -encoding utf-8" faile... artifact: d21b4e1e9c user: dkf | |
|
2013-05-02
| ||
| 03:46 | • New ticket [3612458fff]. artifact: f8282234e3 user: wrenashe | |
"fconfigure stdout -encoding utf-8" failed on windows
Closed / Invalid3612458fffffffffffffffffffffffffffffffffCreated 14 years agoUpdated 14 years ago
Descriptionplain2013-05-02 03:46:30
With my built 8.5.10 I tried to issue command "fconfigure stdout -encoding utf-8" to tclsh on WinXP, the tcl prompt then was shown as two dots instead of percentage sign, C:\>tclsh85t.exe % fconfigure stdout -encoding utf-8 ‥date The current date is: 11/29/2011 Tue Enter the new date: (mm-dd-yy) time The system cannot accept the date entered. Enter the new date: (mm-dd-yy) ‥ ‥ So wonder what's wrong with fconfigure on stdout? Is that the issue? any updates on this with the new version?
dkfplain2013-05-07 16:11:59
allow_comments - 1
Tclsh on Windows is supposed to be able to talk directly to the console (as Unicode, using a Win-native API) so there should be no need to ever set the encoding on the stdout channel there, not unless it has been redirected to a file (when it should work). I'm not really surprised that bad things happen when you try this, though the particular combination is "curious" (it appears to be interpreting the two bytes of the encoding of the prompt, 0x25 followed by 0x20, as the character \u2025 - it's little-endian - which is that two-dot char). If you'd got Tcl to [puts "Hello, World!"] or something like that, you'd have seen other "interesting" chars (Chinese, I think).
% encoding convertfrom unicode [encoding convertto utf-8 "% "]
‥
% encoding convertfrom unicode [encoding convertto utf-8 "Hello, World!"]
效汬Ɐ圠牯摬
The fix? Don't change -encoding when stdout is a terminal. ("Doctor! It hurts when I prod a knife in my eye!" "Well stop doing that then!")
Log in (anonymous is fine) to add a comment.