UTF-8 file paths on Windows

I have been investigating the use of UTF-8 file paths on Windows.

So far I have managed to get G’MIC to read its update file from the GMIC_PATH environment variable, when the directory name uses Japanese characters.
The OS is configured for US English, code page Windows-1252.

This has required patching cimg::is_directory, gmic::init_rc, gmic::path_rc and gmic::user_rc.

Are there any other methods that would need to be fixed?

That’s interesting indeed. Almost all file operations rely on cimg::fopen() and cimg::fclose(), so maybe those should be patched as well (in file CImg.h) ?

cimg::fopen() calls cimg::std_fopen(), which already correctly handles UTF-8 on Windows.

gmic::check_filename is the only other method that I see which would need to be patched, but it is not called by anything.

That’s true, I can remove this function. It has been replace by cimg::is_file() and cimg::is_directory() that you may want to check also (in file CImg.h).

By the way, I’m interested by your changes. Do you plan to make a PR?

Yes, here is the PR for CImg: https://github.com/dtschump/CImg/pull/266.
I am still testing the G’MIC changes.

I noticed that G’MIC does not have an .editorconfig file, I may have to make one so that the tools that support it will use the correct indentation when editing the files.
It appears that both CImg and G’MIC use 2 spaces instead of a tab, correct?

Thanks. I’ll check that.

Yes, we never use TAB as it doesn’t render the same on different editors.

I submitted a PR that adds an EditorConfig file to the gmic repository, https://github.com/dtschump/gmic/pull/217.

1 Like

Sorry for being a noob with git. I’ve applied your PR “manually” as I don’t know how to apply them on the develop branch rather than on master. Shame on me, but thanks anyway :slight_smile:

Here are the gmic changes, https://github.com/dtschump/gmic/pull/219.
I based them in the develop branch this time.

1 Like