Skip to content

Fix contribute watchOngoingGameInFile for non-ASCII paths on Windows - #1253

Closed
Hoigin wants to merge 1 commit into
lightvector:masterfrom
Hoigin:fix-contribute-nonascii-watchfile
Closed

Fix contribute watchOngoingGameInFile for non-ASCII paths on Windows#1253
Hoigin wants to merge 1 commit into
lightvector:masterfrom
Hoigin:fix-contribute-nonascii-watchfile

Conversation

@Hoigin

@Hoigin Hoigin commented Sep 10, 2026

Copy link
Copy Markdown

Summary

On Windows, if the path in watchOngoingGameFileName contains non-ASCII characters, like D:\Go\跑谱\watchgame.txt, KataGo fails to open the watch file, and the whole contribute process terminates a few seconds after startup with:

ERROR: game loop loop thread failed: Could not open file: D:\Go\跑谱\watchgame.txt

The root cause is that the Windows branch opens the file with the narrow-char fopen_s, which interprets the UTF-8 path bytes in the ANSI codepage, so the path no longer matches the real directory (a TODO in contribute.cpp already notes that non-ascii paths are unhandled).

This PR converts the path to wide chars and opens it with _wfopen, the same pattern already used in homedata.cpp and mainargs.cpp.

Testing

Verified on Windows 11 (Chinese locale, GBK codepage), KataGo v1.18.2 + this change, MSVC build with -DBUILD_DISTRIBUTED=1:

  • A path containing a non-ASCII directory (D:\Go\跑谱\watchgame.txt) now creates the file at the correct path. ASCII-only paths behave as before.
  • Invalid UTF-8 in the config value produces a clear StringError.

@lightvector

Copy link
Copy Markdown
Owner

Thanks for reporting! Fixed in a slightly different way, in 9bb7efc

@Hoigin

Hoigin commented Sep 10, 2026

Copy link
Copy Markdown
Author

Verified the alternative fix, closing this in favor of it. Thanks for the great project!

@Hoigin Hoigin closed this Sep 10, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants