diff options
author | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-23 10:42:02 (GMT) |
---|---|---|
committer | jan.nijtmans <nijtmans@users.sourceforge.net> | 2020-10-23 10:42:02 (GMT) |
commit | b214554afac1888e696aabb53e87a04468ec9359 (patch) | |
tree | 87937bdc6d43b4b76fef4c8bdaacd7194425b949 | |
parent | 33ba7348673118b491542cd4ba2e50f04ef249c9 (diff) | |
download | tk-b214554afac1888e696aabb53e87a04468ec9359.zip tk-b214554afac1888e696aabb53e87a04468ec9359.tar.gz tk-b214554afac1888e696aabb53e87a04468ec9359.tar.bz2 |
Always "source -encoding utf-8" Tk's own script files. Since Tk 8.7 runs in either Tcl 8.6 or 8.7, we then can trust the real encoding used, even though (in Tk 8.6) all those files are still ASCII
-rw-r--r-- | library/console.tcl | 4 | ||||
-rw-r--r-- | library/tk.tcl | 6 | ||||
-rw-r--r-- | library/ttk/ttk.tcl | 34 |
3 files changed, 22 insertions, 22 deletions
diff --git a/library/console.tcl b/library/console.tcl index 4e2b9d0..e59e6e2 100644 --- a/library/console.tcl +++ b/library/console.tcl @@ -215,7 +215,7 @@ proc ::tk::ConsoleSource {} { [list [mc "Tcl Scripts"] .tcl] \ [list [mc "All Files"] *]]] if {$filename ne ""} { - set cmd [list source $filename] + set cmd [list source -encoding utf-8 $filename] if {[catch {consoleinterp eval $cmd} result]} { ConsoleOutput stderr "$result\n" } @@ -592,7 +592,7 @@ proc ::tk::ConsoleBind {w} { } bind Console <F9> { eval destroy [winfo child .] - source [file join $tk_library console.tcl] + source -encoding utf-8 [file join $tk_library console.tcl] } if {[tk windowingsystem] eq "aqua"} { bind Console <Command-q> { diff --git a/library/tk.tcl b/library/tk.tcl index 3657511..514ebcf 100644 --- a/library/tk.tcl +++ b/library/tk.tcl @@ -496,7 +496,7 @@ switch -exact -- [tk windowingsystem] { if {$::tk_library ne ""} { proc ::tk::SourceLibFile {file} { - namespace eval :: [list source [file join $::tk_library $file.tcl]] + namespace eval :: [list source -encoding utf-8 [file join $::tk_library $file.tcl]] } namespace eval ::tk { SourceLibFile icons @@ -688,7 +688,7 @@ if {[tk windowingsystem] eq "aqua"} { #stub procedures to respond to "do script" Apple Events proc ::tk::mac::DoScriptFile {file} { uplevel #0 $file - source $file + source -encoding utf-8 $file } proc ::tk::mac::DoScriptText {script} { uplevel #0 $script @@ -703,7 +703,7 @@ set ::tk::Priv(IMETextMark) [dict create] # Run the Ttk themed widget set initialization if {$::ttk::library ne ""} { - uplevel \#0 [list source $::ttk::library/ttk.tcl] + uplevel \#0 [list source -encoding utf-8 $::ttk::library/ttk.tcl] } # Local Variables: diff --git a/library/ttk/ttk.tcl b/library/ttk/ttk.tcl index 665222d..73ee3d9 100644 --- a/library/ttk/ttk.tcl +++ b/library/ttk/ttk.tcl @@ -12,9 +12,9 @@ namespace eval ::ttk { } } -source [file join $::ttk::library fonts.tcl] -source [file join $::ttk::library cursors.tcl] -source [file join $::ttk::library utils.tcl] +source -encoding utf-8 [file join $::ttk::library fonts.tcl] +source -encoding utf-8 [file join $::ttk::library cursors.tcl] +source -encoding utf-8 [file join $::ttk::library utils.tcl] ## ttk::deprecated $old $new -- # Define $old command as a deprecated alias for $new command @@ -97,18 +97,18 @@ proc ::ttk::setTheme {theme} { ### Load widget bindings. # -source [file join $::ttk::library button.tcl] -source [file join $::ttk::library menubutton.tcl] -source [file join $::ttk::library scrollbar.tcl] -source [file join $::ttk::library scale.tcl] -source [file join $::ttk::library progress.tcl] -source [file join $::ttk::library notebook.tcl] -source [file join $::ttk::library panedwindow.tcl] -source [file join $::ttk::library entry.tcl] -source [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl -source [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl -source [file join $::ttk::library treeview.tcl] -source [file join $::ttk::library sizegrip.tcl] +source -encoding utf-8 [file join $::ttk::library button.tcl] +source -encoding utf-8 [file join $::ttk::library menubutton.tcl] +source -encoding utf-8 [file join $::ttk::library scrollbar.tcl] +source -encoding utf-8 [file join $::ttk::library scale.tcl] +source -encoding utf-8 [file join $::ttk::library progress.tcl] +source -encoding utf-8 [file join $::ttk::library notebook.tcl] +source -encoding utf-8 [file join $::ttk::library panedwindow.tcl] +source -encoding utf-8 [file join $::ttk::library entry.tcl] +source -encoding utf-8 [file join $::ttk::library combobox.tcl] ;# dependency: entry.tcl +source -encoding utf-8 [file join $::ttk::library spinbox.tcl] ;# dependency: entry.tcl +source -encoding utf-8 [file join $::ttk::library treeview.tcl] +source -encoding utf-8 [file join $::ttk::library sizegrip.tcl] ## Label and Labelframe bindings: # (not enough to justify their own file...) @@ -122,7 +122,7 @@ proc ttk::LoadThemes {} { variable library # "default" always present: - uplevel #0 [list source [file join $library defaults.tcl]] + uplevel #0 [list source -encoding utf-8 [file join $library defaults.tcl]] set builtinThemes [style theme names] foreach {theme scripts} { @@ -135,7 +135,7 @@ proc ttk::LoadThemes {} { } { if {[lsearch -exact $builtinThemes $theme] >= 0} { foreach script $scripts { - uplevel #0 [list source [file join $library $script]] + uplevel #0 [list source -encoding utf-8 [file join $library $script]] } } } |