-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
[Windows] load image with filenames other than english #7435
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Hey @oxillo please check this PR when you have the time. I don't know much about windows but I've tried to fix path encodings there, it seems to be working. |
PS: there is a test there meant to be removed before merge |
@roymacdonald thanks I've fixed the dialog title issues in latest and updated the repo with more tests and more filenames. |
Interesting. What ever it is that causes a kernel panic it must not be nice. No idea from my side. I mostly work on macos |
@dimitre do you have a trace on that crash? maybe the cyrilic are actually truly non-convertible wide (a lot of unicode is convertible wide->narrow, everything on the basic plane will not cause an exception with one way to isolate the source encoding is by passing actual bytes like std::wstring s = L"Hello, \u4E16\u754C!"; // "Hello, 世界!" so whatever happens to the intepretation of the glyphs in the file, the string will be built with the actual codepoints (and as far as i can tell, those are true wides, but i did not find a super clear reference about that). if you can capture the wchar that trigger your crash they would be helpful for future testing. (it would be very great if the MSVC tests in OF github CI could be augmented and also fail. right now it seems MSVC is passing everything although it should not... maybe a "hosted"/VM thing?) |
@artificiel I don't have the trace. I only have occasional access to a slow windows "box" |
Hi @dimitre, testing on Windows 10 with your branch, |
Maybe a FreeImage problem
…On Fri, 25 Oct 2024 at 11:58 am, Nick Hardeman ***@***.***> wrote:
Hi @dimitre <https://github.com/dimitre>, testing on Windows 10 with your
branch,
I get the following error in the debug console
[ error ] ofImage: loadImage(): couldn't load image from "consolação.jpg"
image.png (view on web)
<https://github.com/user-attachments/assets/1bc68c2f-7784-4f40-8790-746371ff2c98>
—
Reply to this email directly, view it on GitHub
<#7435 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAGK2HGPGSDZ4KV7UYGK2TDZ5GJTXAVCNFSM6AAAAAAWILUPA2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDIMZWGU4TIMZXGY>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
@NickHardeman can you check image.load("consolação.jpg"); is correctly encoded |
@artificiel This is the configuration property I found for unicode and it was already set for the openframeworksLib and WinEcoding project. |
@NickHardeman the file encoding i meant was not for the image itself but the .cpp that contains the quoted string! |
Not sure how, but passing in a narrow string to a path constructor and then passing that to image.load() also works.
|
If I remove the const and reference & from the image load function, then it works with a narrow string.
|
The idea behind this PR is to use std::filesystem::path object to store the filename until right up the freeimage function is called. FreeImage has some special functions to handle wstring, so they are called for windows, conserving original encoding.