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:
Priority: 5 Medium Severity: Minor
Status: Open Last Modified: 2026-10-08 15:49:36
Resolution: None Closed By:
    Closed on:
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.