Skip to content

Conversation

kuguma
Copy link

@kuguma kuguma commented Oct 16, 2025

Summary

Fixed path handling in the mtmd feature on Windows to correctly convert and process non-ASCII file paths.

Additionally, fixed a missing console initialization in mtmd-cli.

Issues Resolved

  • Failed to load .mmproj files with non-ASCII file paths

  • Failed to load image files with non-ASCII file paths

  • Incorrect path parsing in mtmd-cli when using /image <filepath> with non-ASCII characters

Comparison of behavior

Windows 11 Pro 24H2

PS > Get-WinSystemLocale
LCID             Name             DisplayName
----             ----             -----------
1041             ja-JP            Japanese (Japan)
PS > [Console]::InputEncoding.EncodingName
Japanese (Shift-JIS)
PS > [Console]::OutputEncoding.EncodingName
Unicode (UTF-8)

b6756

PS > llama-mtmd-cli.exe -m ... --mmproj ...
~~~
> /image テスト画像.jpg
Unable to open file ツテツスツトツ嘉ヲツ堕・jpg: Illegal byte sequence

This PR

PS > llama-mtmd-cli.exe -m ... --mmproj ...
~~~
> /image テスト画像.jpg
テスト画像.jpg image loaded

Notes

The general argument-handling logic in llama.cpp also has issues with non-ASCII paths.
Since the impact area is broad, I will submit a separate PR to address this.

@kuguma kuguma changed the title Add non-ASCII file path support to the mtmd feature on Windows mtmd : Fix/Add non-ASCII file path support on Windows Oct 16, 2025
@kuguma
Copy link
Author

kuguma commented Oct 16, 2025

Fixed an unintended change in the PR.

FILE * f = fopen(fname, "rb");
if (!f) {
LOG_ERR("Unable to open file %s: %s\n", fname, strerror(errno));
fprintf(stderr, "Unable to open file %s: %s\n", fname, strerror(errno));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why we cannot use LOG_ERR here?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixed to use LOG_ERR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants