@@ -119,7 +119,7 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
119119 $basename$patch library]
120120 }
121121 }
122- # uniquify $dirs in order
122+ # make $dirs unique, preserving order
123123 array set seen {}
124124 foreach i $dirs {
125125 # Make sure $i is unique under normalization. Avoid repeated [source].
@@ -140,13 +140,13 @@ proc tcl_findLibrary {basename version patch initScript enVarName varName} {
140140 # source everything when in a safe interpreter because we have a
141141 # source command, but no file exists command
142142
143- if {[interp issafe] || [file exists $file ]} {
144- if {![catch {uplevel #0 [list source $file ]} msg opts]} {
145- return
146- }
143+ if {[interp issafe] || [file exists $file ]} {
144+ if {![catch {uplevel #0 [list source -encoding utf-8 $file ]} msg opts]} {
145+ return
146+ }
147147 append errors " $file : $msg \n "
148148 append errors [dict get $opts -errorinfo]\n
149- }
149+ }
150150 }
151151 unset -nocomplain the_library
152152 set msg " Can't find a usable $initScript in the following directories: \n "
@@ -214,6 +214,7 @@ proc auto_mkindex {dir args} {
214214 auto_mkindex_parser::cleanup
215215
216216 set fid [open " tclIndex" w]
217+ fconfigure $fid -encoding utf-8
217218 puts -nonewline $fid $index
218219 close $fid
219220 cd $oldDir
@@ -240,12 +241,12 @@ proc auto_mkindex_old {dir args} {
240241 set f " "
241242 set error [catch {
242243 set f [open $file ]
243- fconfigure $f -eofchar " \032 {}"
244+ fconfigure $f -eofchar " \x1A {}"
244245 while {[gets $f line] >= 0} {
245246 if {[regexp {^proc[ ]+([^ ]*)} $line match procName]} {
246247 set procName [lindex [auto_qualify $procName " ::" ] 0]
247248 append index " set [ list auto_index($procName )] "
248- append index " \[ list source \[ file join \$ dir [ list $file ] \]\]\n "
249+ append index " \[ list source -encoding utf-8 \[ file join \$ dir [ list $file ] \]\]\n "
249250 }
250251 }
251252 close $f
@@ -317,7 +318,7 @@ namespace eval auto_mkindex_parser {
317318 $parser expose eval
318319 $parser invokehidden rename eval _%@eval
319320
320- # Install all the registered psuedo -command implementations
321+ # Install all the registered pseudo -command implementations
321322
322323 foreach cmd $initCommands {
323324 eval $cmd
@@ -351,7 +352,7 @@ proc auto_mkindex_parser::mkindex {file} {
351352 set scriptFile $file
352353
353354 set fid [open $file ]
354- fconfigure $fid -eofchar " \032 {}"
355+ fconfigure $fid -eofchar " \x1A {}"
355356 set contents [read $fid ]
356357 close $fid
357358
@@ -531,7 +532,7 @@ proc auto_mkindex_parser::indexEntry {name} {
531532 set filenameParts [file split $scriptFile ]
532533
533534 append index [format \
534- {set auto_index(%s) [list source [file join $dir %s]]%s} \
535+ {set auto_index(%s) [list source -encoding utf-8 [file join $dir %s]]%s} \
535536 $name $filenameParts \n ]
536537 return
537538}
@@ -570,7 +571,7 @@ auto_mkindex_parser::hook {
570571 load {} tbcload $auto_mkindex_parser::parser
571572
572573 # AUTO MKINDEX: tbcload::bcproc name arglist body
573- # Adds an entry to the auto index list for the given pre-compiled
574+ # Adds an entry to the auto index list for the given precompiled
574575 # procedure name.
575576
576577 auto_mkindex_parser::commandInit tbcload::bcproc {name args} {
@@ -625,7 +626,7 @@ auto_mkindex_parser::command namespace {op args} {
625626 }
626627 regsub -all ::+ $name :: name
627628 }
628- # create artifical proc to force an entry in the tclIndex
629+ # create artificial proc to force an entry in the tclIndex
629630 $parser eval [list ::proc $name {} {}]
630631 }
631632 }
0 commit comments