Tk Source Code

View Ticket
Login
Ticket UUID: 2898114
Title: wish/tclsh unable run in directories with non-Latin chars
Type: Bug Version: obsolete: 8.5.13
Submitter: pcaffin Created on: 2009-11-15 18:14:19
Subsystem: 99. Other Assigned To: jan.nijtmans
Priority: 5 Medium Severity:
Status: Closed Last Modified: 2014-03-13 09:05:24
Resolution: Fixed Closed By: nijtmans
    Closed on: 2013-01-08 10:45:09
Description:
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.
User Comments: nijtmans added on 2013-01-08 17:45:09:
Fixed in Tk 8.6.0

nijtmans added on 2012-04-06 15:58:55:
This should be fixed with Tcl/Tk 8.6

hobbs added on 2009-11-17 00:21:19:
davygrvy recognized the WinMain issue and there should be another outstanding bug with perhaps a patch that discusses this further.

mickey_knox added on 2009-11-16 22:50:02:
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.

dgp added on 2009-11-16 22:38:08:
So the problem is that [encoding system] cannot encode
all the characters found on the system?

mickey_knox added on 2009-11-16 08:37:59:
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.