diff options
Diffstat (limited to 'library')
-rw-r--r-- | library/auto.tcl | 8 | ||||
-rw-r--r-- | library/init.tcl | 2 | ||||
-rw-r--r-- | library/package.tcl | 2 | ||||
-rw-r--r-- | library/tcltest/tcltest.tcl | 18 |
4 files changed, 24 insertions, 6 deletions
diff --git a/library/auto.tcl b/library/auto.tcl index 7c9f38c..2eacf8c 100644 --- a/library/auto.tcl +++ b/library/auto.tcl @@ -265,7 +265,7 @@ proc auto_mkindex {dir args} { auto_mkindex_parser::cleanup set fid [open "tclIndex" w] - fconfigure $fid -translation lf + fconfigure $fid -encoding utf-8 -translation lf puts -nonewline $fid $index close $fid cd $oldDir @@ -292,7 +292,7 @@ proc auto_mkindex_old {dir args} { set f "" set error [catch { set f [open $file] - fconfigure $f -eofchar \032 + fconfigure $f -encoding utf-8 -eofchar \032 while {[gets $f line] >= 0} { if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} { set procName [lindex [auto_qualify $procName "::"] 0] @@ -311,7 +311,7 @@ proc auto_mkindex_old {dir args} { set f "" set error [catch { set f [open tclIndex w] - fconfigure $f -translation lf + fconfigure $f -encoding utf-8 -translation lf puts -nonewline $f $index close $f cd $oldDir @@ -404,7 +404,7 @@ proc auto_mkindex_parser::mkindex {file} { set scriptFile $file set fid [open $file] - fconfigure $fid -eofchar \032 + fconfigure $fid -encoding utf-8 -eofchar \032 set contents [read $fid] close $fid diff --git a/library/init.tcl b/library/init.tcl index b25a318..c5b9705 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -442,7 +442,7 @@ proc auto_load_index {} { continue } else { set error [catch { - fconfigure $f -eofchar \032 + fconfigure $f -encoding utf-8 -eofchar \032 set id [gets $f] if {$id eq "# Tcl autoload index file, version 2.0"} { eval [read $f] diff --git a/library/package.tcl b/library/package.tcl index 7df9fe4..5f0795f 100644 --- a/library/package.tcl +++ b/library/package.tcl @@ -409,7 +409,7 @@ proc pkg_mkIndex {args} { } set f [open [file join $dir pkgIndex.tcl] w] - fconfigure $f -translation lf + fconfigure $f -encoding utf-8 -translation lf puts $f $index close $f } diff --git a/library/tcltest/tcltest.tcl b/library/tcltest/tcltest.tcl index 7dc75d7..aebc6e5 100644 --- a/library/tcltest/tcltest.tcl +++ b/library/tcltest/tcltest.tcl @@ -399,6 +399,9 @@ namespace eval tcltest { } default { set outputChannel [open $filename a] + if {[package vsatisfies [package provide Tcl] 8.7-]} { + fconfigure $outputChannel -encoding utf-8 + } set ChannelsWeOpened($outputChannel) 1 # If we created the file in [temporaryDirectory], then @@ -443,6 +446,9 @@ namespace eval tcltest { } default { set errorChannel [open $filename a] + if {[package vsatisfies [package provide Tcl] 8.7-]} { + fconfigure $errorChannel -encoding utf-8 + } set ChannelsWeOpened($errorChannel) 1 # If we created the file in [temporaryDirectory], then @@ -785,6 +791,9 @@ namespace eval tcltest { variable Option if {$Option(-loadfile) eq {}} {return} set tmp [open $Option(-loadfile) r] + if {[package vsatisfies [package provide Tcl] 8.7-]} { + fconfigure $tmp -encoding utf-8 + } loadScript [read $tmp] close $tmp } @@ -1330,6 +1339,9 @@ proc tcltest::DefineConstraintInitializers {} { ConstraintInitializer stdio { set code 0 if {![catch {set f [open "|[list [interpreter]]" w]}]} { + if {[package vsatisfies [package provide Tcl] 8.7-]} { + fconfigure $f -encoding utf-8 + } if {![catch {puts $f exit}]} { if {![catch {close $f}]} { set code 1 @@ -2177,6 +2189,9 @@ proc tcltest::test {name description args} { set testFile [file normalize [uplevel 1 {info script}]] if {[file readable $testFile]} { set testFd [open $testFile r] + if {[package vsatisfies [package provide Tcl] 8.7-]} { + fconfigure $testFd -encoding utf-8 + } set testLine [expr {[lsearch -regexp \ [split [read $testFd] "\n"] \ "^\[ \t\]*test [string map {. \\.} $name] "] + 1}] @@ -2885,6 +2900,9 @@ proc tcltest::runAllTests { {shell ""} } { if {[catch { incr numTestFiles set pipeFd [open $cmd "r"] + if {[package vsatisfies [package provide Tcl] 8.7-]} { + fconfigure $pipeFd -encoding utf-8 + } while {[gets $pipeFd line] >= 0} { if {[regexp [join { {^([^:]+):\t} |