openFrameworks icon indicating copy to clipboard operation
openFrameworks copied to clipboard

[Windows] load image with filenames other than english

Open dimitre opened this issue 2 years ago • 29 comments

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.

dimitre avatar Mar 26 '23 19:03 dimitre

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.

dimitre avatar Mar 26 '23 20:03 dimitre

PS: there is a test there meant to be removed before merge

dimitre avatar Mar 26 '23 20:03 dimitre

@dimitre the UTF16 encoding of filenames in Windows is generally hard to handle. I'm not an expert on that. I've tested on MINGW64 and UCRT64. The system dialogs works fine in both environments. So I think the filepaths are correctly handled. The only problem is on console output that doesn't work in MINGW64 but it was expected.

oxillo avatar Mar 28 '23 20:03 oxillo

Nice. it worked here in a file called consolação.jpg on which didnt load before. I've put this file temporarly on this pr on examples/dimitre/Test folder. It is latin so I'm not sure about other languages @artificiel any opinion on this one?

dimitre avatar Mar 28 '23 22:03 dimitre

think this one should wait for after 0.12.0 as I see some possible issues here with the changes required.

ofTheo avatar Apr 19 '23 20:04 ofTheo

I've finally got a windows machine and some time to advance on this PR and test. I think it is good to merge. It addresses encoding issues loading files, and with the title in open file dialog box. I think the only controversial change here is the return type change in of::filesystem::path ofFileDialogResult::getName() and ofFileDialogResult::getPath()

opinions are welcome @ofTheo @oxillo @artificiel @openframeworks/windows

dimitre avatar Dec 06 '23 23:12 dimitre

Hello @ofTheo I think this one is good to go. Resolves a dread windows problem where you cannot load files in ofSystemLoadDialog with any accentuation and pass correctly to load an ofImage.

There is a test here: https://github.com/dimitre/ofTests/tree/main/WinEncoding

https://github.com/openframeworks/openFrameworks/pull/7435#issuecomment-1515304092

dimitre avatar May 13 '24 15:05 dimitre

@danoli3 can you double check this one if you have the time? btw, thanks for the other windows PR merging, OF is almost ready to work with multiple languages

dimitre avatar Jul 28 '24 17:07 dimitre