open files in windows with spaces

This is common problem when using tcl/tk in windows machines. When a file is open with the tk_getOpenFile and it has spaces in the name , tcl/Tk does no recognize them.

This is an example of the code

set types {
    {{Text Files}       {.txt}        }
    {{TCL Scripts}      {.tcl}        }
}
set fileName [tk_getOpenFile -filetypes $types]

if {$fileName != ""} {
    # Open the file ...
    puts $fileName
}

what is the best solution to solve this problem ?


MG 3/12/18 Tcl has no issue with paths with spaces; your example above certainly doesn't show one. Running this and selecting a file with a space in its name from the dialog gives me exactly what I'd expect, outputting the path name (for instance, "C:/Users/Mike/Desktop/Foo Bar Baz.txt") in the console. You may need to give a more complete example or explain your issue in more detail.