Unconsistent command-line parsing in case of UTF-8 quoted arguments

Jérôme Froissart software@froissart.eu
Wed Oct 7 22:21:34 GMT 2020


Thanks for your reply.

Andrey Repin wrote:
> 1. Run CMD in a more capable terminal. Either M$ Terminal 1.0, or select true
> type font for your console.
I tried Windows Terminal 1.3, but this did not change anything :-(
Besides, I think my cmd.exe was already using True Type fonts (if I
understand the icons from the settings window correctly)

Anyway, I now understand that the terminal I use matters. In my case
however, I do not intend to run the binary (built with Cygwin) in a
terminal at all.
I am using win-sshfs [2]. It is built from Cygwin, but it is then used
as a standalone executable, without any GUI. It is called by a Windows
component/driver (with a command line that contains quoted UTF-8
arguments), invoked by some clicks and actions from the 'My computer'
window. What could I do so that this program correctly handles the
command line?
> 2. Then you are parsing the command line wrong. In Windows, it is up to called
> program to parse the command line.
Right, but my program starts at `int main(int argc, char *argv[])`,
where the parsing is already handled (by some Cygwin runtime
component?). How could I parse it differently?
And would that even make sense that I parse it in a custom way? Since
-I suppose- every C program built by Cygwin faces the same issues,
wouldn't we rather want a "universal" change on how the Cygwin runtime
parses command lines?
For the record, this is what I have done in this program [1], but that
feels more like a work around some UTF-8-related bug than a proper,
custom command line parsing :-S

...or maybe I'm completely mistaken in how Cygwin works, in case I'd
be happy to be told :-)

[1] https://github.com/billziss-gh/sshfs-win/pull/208
[2] https://github.com/billziss-gh/sshfs-win

Thanks for your help
Jérôme


More information about the Cygwin mailing list