Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: d21b4e1e9c98a58a3a74540ff1ea26a89bc614ca
Ticket: 3612458fffffffffffffffffffffffffffffffff
"fconfigure stdout -encoding utf-8" failed on windows
User & Date: dkf on 2013-05-07 16:11:59
Changes

  1. closedate changed to: "2013-05-07T09:11:59"
  2. closer changed to: "dkf"
  3. icomment:
    
    
    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!")
    
    
  4. login: "dkf"
  5. mimetype: "text/plain"
  6. resolution changed to: "Invalid"
  7. status changed to: "Closed"
  8. subsystem changed to: "27. Channel Types"
  9. username: "dkf"