Menu

#223 accented chars in path names

9.0
closed
nobody
None
Bug
major
2020-02-06
2019-12-04
No

There is a problem with file::hasOpenWindows if the argument is a path with accented letters.
The problem is with [winNames -f], which returns window names with composed 2-byte-encoded accented letters. The string comparison detects the encoding difference.
I seem to remember that Alpha already has some normal-form procs for handling this kind of situation. If would be good if they could be applied to winNames.

Discussion

  • Bernard Desgraupes

    You are right, this is a problem of composed vs. decomposed Unicode form. The proc [file::hasOpenWindows] applies, on its argument, [file::ensureStandardPath] which invokes [file nativename] and [file normalize]: this converts the path to Unicode formC. But it should apply the same standardization on the paths returned by [winNames -f].
    This is fixed now. Changes committed to the repository (rev. 1837).

    For the record, here is the new definition of [file::hasOpenWindows] :

    proc file::hasOpenWindows {fileName} {
        set n [file::ensureStandardPath $fileName]
        # Resolve symbolic links:
        if { [file exists $n] && [file type $n] eq "link" } {
            set n [file readlink $n]
        }
        set res [list]
        foreach w [winNames -f] {
            if {[file::ensureStandardPath [win::StripCount $w]] eq $n} {
                lappend res $w
            }
        }
        return $res
    }
    

    BTW, I have added in fileManipulation.tcl a new proc [file::equalPaths] to compare two paths regardless of the Unicode form.

     
  • Bernard Desgraupes

    • status: open --> fixed
     
  • Bernard Desgraupes

    • status: fixed --> closed
     

Log in to post a comment.