From aacd5eef2d2bf6b7d03aad0941282762e8957566 Mon Sep 17 00:00:00 2001 From: "jan.nijtmans" Date: Wed, 12 Jun 2024 12:10:50 +0000 Subject: Fix [1d26e580cf]: safe interp can't source files with BOM. (init.tcl has a BOM now, for testing purposes. Don't merge this to core-8-6-branch!) --- library/init.tcl | 2 +- library/safe.tcl | 4 ++++ 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/library/init.tcl b/library/init.tcl index a6745ab..81e6243 100644 --- a/library/init.tcl +++ b/library/init.tcl @@ -1,4 +1,4 @@ -# init.tcl -- +# init.tcl -- # # Default system startup file for Tcl-based applications. Defines # "unknown" procedure and auto-load facilities. diff --git a/library/safe.tcl b/library/safe.tcl index 71c1e67..9c605f2 100644 --- a/library/safe.tcl +++ b/library/safe.tcl @@ -987,6 +987,10 @@ proc ::safe::AliasSource {child args} { fconfigure $f -encoding $encoding } set contents [read $f] + # See [Bug 1d26e580cf] + if {[string index $contents 0] eq "\uFEFF"} { + set contents [string range $contents 1 end] + } close $f ::interp eval $child [list info script $file] } msg opt] -- cgit v0.12