diff --git a/generic/itclBase.c b/generic/itclBase.c index 53a84e59..5f167ebd 100644 --- a/generic/itclBase.c +++ b/generic/itclBase.c @@ -56,7 +56,7 @@ static const char initScript[] = " }\n" " foreach i $dirs {\n" " set library $i\n" -" if {![catch {uplevel #0 [list source [file join $i itcl.tcl]]}]} {\n" +" if {![catch {uplevel #0 [list source -encoding utf-8 [file join $i itcl.tcl]]}]} {\n" " set library $i\n" " return\n" " }\n" diff --git a/generic/itclBuiltin.c b/generic/itclBuiltin.c index a5cd06ef..f822b878 100644 --- a/generic/itclBuiltin.c +++ b/generic/itclBuiltin.c @@ -72,7 +72,7 @@ static char initHullCmdsScript[] = " foreach i $dirs {\n" " set library $i\n" " set itclfile [file join $i itclHullCmds.tcl]\n" -" if {![catch {uplevel #0 [list source $itclfile]} msg]} {\n" +" if {![catch {uplevel #0 [list source -encoding utf-8 $itclfile]} msg]} {\n" " return\n" " }\n" "puts stderr \"MSG!$msg!\"\n" diff --git a/library/itcl.tcl b/library/itcl.tcl index f68481d7..7a1bdeea 100644 --- a/library/itcl.tcl +++ b/library/itcl.tcl @@ -53,7 +53,7 @@ foreach __cmd {itcl::class class itcl::type type ictl::widget widget itcl::widge variable index variable scriptFile append index "set [list auto_index([fullname $name])]" - append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" variable parser variable contextStack @@ -72,7 +72,7 @@ foreach __cmd {itcl::body body} { variable index variable scriptFile append index "set [list auto_index([fullname $name])]" - append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" } } @@ -85,7 +85,7 @@ foreach __cmd {itcl::configbody configbody} { variable index variable scriptFile append index "set [list auto_index([fullname $name])]" - append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" } } @@ -98,7 +98,7 @@ foreach __cmd {itcl::ensemble ensemble} { variable index variable scriptFile append index "set [list auto_index([fullname $name])]" - append index " \[list source \[file join \$dir [list $scriptFile]\]\]\n" + append index " \[list source -encoding utf-8 \[file join \$dir [list $scriptFile]\]\]\n" } } diff --git a/tests/helpers.tcl b/tests/helpers.tcl index 62a3d678..ca5ab3a6 100644 --- a/tests/helpers.tcl +++ b/tests/helpers.tcl @@ -36,7 +36,7 @@ if {[namespace which -command memory] ne "" && ( load {} Itcl i i eval {set ::tcl::inl_mem_test 0} i eval {package require tcltest; @testargv@} - i eval [list source @test@] + i eval [list source -encoding utf-8 @test@] interp delete i }]] if {$leak} { diff --git a/tests/mkindex.test b/tests/mkindex.test index 74e331db..3f7fe217 100644 --- a/tests/mkindex.test +++ b/tests/mkindex.test @@ -37,9 +37,9 @@ test mkindex-1.2 {build tclIndex based on a test file} { file exists tclIndex } {1} -set element "{source [file join . mkindex.itcl]}" +set element "{source *[file join . mkindex.itcl]}" -test mkindex-1.3 {examine tclIndex} { +test mkindex-1.3 {examine tclIndex} -body { namespace eval itcl_mkindex_tmp { set dir "." variable auto_index @@ -50,7 +50,7 @@ test mkindex-1.3 {examine tclIndex} { } set result } -} "{::Simple2::bump $element} {::Simple2::by $element} {::buried::deep::within $element} {::buried::ens $element} {::buried::inside $element} {::buried::inside::bump $element} {::buried::inside::by $element} {::buried::inside::find $element} {::buried::under::neath $element} {::top::find $element} {::top::notice $element} {Simple1 $element} {Simple2 $element} {ens $element} {top $element}" +} -match glob -result "{::Simple2::bump $element} {::Simple2::by $element} {::buried::deep::within $element} {::buried::ens $element} {::buried::inside $element} {::buried::inside::bump $element} {::buried::inside::by $element} {::buried::inside::find $element} {::buried::under::neath $element} {::top::find $element} {::top::notice $element} {Simple1 $element} {Simple2 $element} {ens $element} {top $element}" file delete tclIndex ::tcltest::cleanupTests diff --git a/tests/tclIndex b/tests/tclIndex index 4f6bdaeb..486523f7 100644 --- a/tests/tclIndex +++ b/tests/tclIndex @@ -6,18 +6,18 @@ # element name is the name of a command and the value is # a script that loads the command. -set auto_index(Simple1) [list source [file join $dir mkindex.itcl]] -set auto_index(Simple2) [list source [file join $dir mkindex.itcl]] -set auto_index(ens) [list source [file join $dir mkindex.itcl]] -set auto_index(::Simple2::bump) [list source [file join $dir mkindex.itcl]] -set auto_index(::Simple2::by) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::inside) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::inside::find) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::inside::bump) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::inside::by) [list source [file join $dir mkindex.itcl]] -set auto_index(top) [list source [file join $dir mkindex.itcl]] -set auto_index(::top::find) [list source [file join $dir mkindex.itcl]] -set auto_index(::top::notice) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::ens) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::under::neath) [list source [file join $dir mkindex.itcl]] -set auto_index(::buried::deep::within) [list source [file join $dir mkindex.itcl]] +set auto_index(Simple1) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(Simple2) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(ens) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::Simple2::bump) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::Simple2::by) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::inside) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::inside::find) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::inside::bump) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::inside::by) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(top) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::top::find) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::top::notice) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::ens) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::under::neath) [list source -encoding utf-8 [file join $dir mkindex.itcl]] +set auto_index(::buried::deep::within) [list source -encoding utf-8 [file join $dir mkindex.itcl]]