Skip to content
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

UTF8/Unicode config filename not supported on Windows #912

Open
r2d3 opened this issue Aug 3, 2023 · 5 comments
Open

UTF8/Unicode config filename not supported on Windows #912

r2d3 opened this issue Aug 3, 2023 · 5 comments

Comments

@r2d3
Copy link

r2d3 commented Aug 3, 2023

If I create a config filename with non ascii characters,

./my_app --print > déjà

When I call: ./my_app --config déjà, I got:

my_app-cli.exe --config déjà
déjà was not readable (missing?)
Run with --help for more information.
@r2d3
Copy link
Author

r2d3 commented Aug 3, 2023

I tried using CLI11 version including #875 #878, but this does not solve this issue

@phlptp
Copy link
Collaborator

phlptp commented Aug 4, 2023

What is the code you are using to parse the arguments?

@r2d3
Copy link
Author

r2d3 commented Aug 5, 2023

Here is the code to reproduce cli11_bug912.tgz

And the command:

# Non accentuated config works
$ cli11_bug --print foo > config
$ cli11_bug -c config
foo

$ cp config déjà
$ cli11_bug -c déjà
déjà was not readable (missing?)
Run with --help for more information.
#include <CLI/CLI.hpp>

#include <iostream>
#include <string>

#ifdef _WIN32
int wmain(int argc, wchar_t* argv[])
#else
int main(int argc, char* argv[])
#endif
{
    std::string filename;
    CLI::App app("cli11_bug");
    app.set_config("-c,--config");
    app.add_flag("--print", "Print configuration and exit")->configurable(false);
    app.add_option("file", filename, "File to process");

    CLI11_PARSE(app);

    if (app.get_option("--print")->as<bool>())
    {
        std::cout << app.config_to_str(true, true);
        return 0;
    }

    std::cout << filename << std::endl;

    return 0;
}

@r2d3
Copy link
Author

r2d3 commented Aug 5, 2023

I am using Git bash to do the cp command with accentuated characters

@bindreams
Copy link
Contributor

bindreams commented Sep 27, 2023

So far I was unable to reproduce this, neither on git bash, nor on powershell 5/7, nor on command prompt.

From experience, Unicode on Windows can get corrupted at a number of stages. Could you check a couple of settings for me:

  • What terminal are you using? Normal windows terminal is cohost.exe, if you are running in Windows Terminal it's wt.exe, and I believe Git suggests MSYS2-style terminal which is MinTTY.
  • Does your Windows installation have this checkmark set:
    image
  • Can you reproduce this bug if repeating all the steps from PowerShell 7.x instead of Git bash?

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

No branches or pull requests

3 participants