Tk Source Code

View Ticket
Login
Ticket UUID: 0d4c0897dcff74946ba92d66ce3c169c2e6f182
Title: Windows: cursor files with non-ASCII names cannot be loaded
Type: Bug Version: 8.6.18, 9.0.5, 9.1.0
Submitter: serhiy.storchaka Created on: 2026-10-08 15:49:36
Subsystem: 31. Cursor Names Assigned To: aku
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2026-10-16 16:44:57
Resolution: Fixed Closed By: nemethi
    Closed on: 2026-10-16 16:19:32
Description:

On Windows, -cursor @file fails with "bad cursor spec" if the path of the file contains characters which are not in the ANSI code page of the system, for example:

button .b -cursor [list @C:/cursors/\u00E9\u0436\u03BB\u65E5.cur]

TkGetCursorByName() in win/tkWinCursor.c passes the file name, which is in UTF-8, to LoadCursorFromFileA(), which expects the ANSI code page.

Proposed fix in branch win-cursor-unicode-path: convert the file name to the native path with Tcl_FSGetNativePath() and use LoadCursorFromFileW(). New test cursor-2.9 (a file name with Latin-1, Cyrillic, Greek and CJK characters) fails without the fix on Windows 11. The branch is based on cursor-file-tests, which provides the cursor file used by the test.

User Comments: serhiy.storchaka added on 2026-10-16 16:44:57:

Backported to core-8-6-branch in [eca61ccb78]. Tested on Windows 11: a cursor file named éжλ日.cur gives "bad cursor spec" without the fix and loads with it.


nemethi (claiming to be Csaba Nemethi) added on 2026-10-16 16:19:32:

Merged by Jan into main and core-9-0-branch by commits [915acfec] and [50cb8e89].