To reproduce the bug:
1. Create a directory: C:\软件 (or any directory name with non-Latin1 characters)
2. Edit a new file with Notepad: C:\软件\test.tcl with content: tk_messageBox -message "Hullo world!"
3. Save the file and double-click it in Windows Explorer.
Result: "couldn't read file "C:\??\test.tcl": no such file or directory."
Platform tested with: Windows XP SP3.
It is not completely true. Non-Latin1 characters do not always cause failure - only those, that fall off the current ANSI codepage. For example, on Polish WinXP I can successfully execute C:\ąę\test.tcl, but Wish fails to open C:\деревня\test.tcl - in the first example all characters can be represented in codepage 1250, which is not the case in the second example.
So the problem is that [encoding system] cannot encode
all the characters found on the system?
I think the problem is that WinMain is an ANSI function (argv is char**), so the command line comes in ANSI version (C-runtime does this, I think).
This is not a single function change, I'm afraid. You can easily call GetCommandLineW to get UNICODE command line version, but what next? Tk_MainEx is, again, ANSI - so conversion is needed - and again out-of-codepage characters will be lost.
davygrvy recognized the WinMain issue and there should be another outstanding bug with perhaps a patch that discusses this further.
This should be fixed with Tcl/Tk 8.6
Fixed in Tk 8.6.0