1#! /usr/bin/env tclsh 2 3# Copyright © 2019 Poor Yorick 4 5if {[string equal $::tcl_platform(os) "Windows NT"]} { 6 return 7} 8 9namespace eval ::tcl::test::fileSystemEncoding { 10 11 if {"::tcltest" ni [namespace children]} { 12 package require tcltest 2.5 13 namespace import -force ::tcltest::* 14 } 15 16 variable fname1 登鸛鵲樓 17 18 proc autopath {} { 19 global auto_path 20 set scriptpath [info script] 21 set scriptpathnorm [file dirname [file normalize $scriptpath/...]] 22 set dirnorm [file dirname $scriptpathnorm] 23 set idx [lsearch -exact $auto_path $dirnorm] 24 if {$idx >= 0} { 25 set auto_path [lreplace $auto_path[set auto_path {}] $idx $idx {}] 26 } 27 set auto_path [linsert $auto_path[set auto_path {}] 0 0 $dirnorm] 28 } 29 autopath 30 31 package require tcltests 32 33 test filesystemEncoding-1.0 { 34 issue bcd100410465 35 } -body { 36 set dir [tcltests::tempdir] 37 set saved [encoding system] 38 encoding system iso8859-1 39 set fname1a $dir/$fname1 40 set utf8name [encoding convertto utf-8 $fname1a] 41 makeFile {} $utf8name 42 set globbed [lindex [glob -directory $dir *] 0] 43 encoding system utf-8 44 set res [file exists $globbed] 45 encoding system iso8859-1 46 lappend res [file exists $globbed] 47 return $res 48 } -cleanup { 49 removeFile $utf8name 50 file delete -force $dir 51 encoding system $saved 52 } -result {0 1} 53 54 cleanupTests 55} 56