public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Andrey Repin <anrdaemon@yandex.ru>
To: "Jérôme Froissart" <software@froissart.eu>, cygwin@cygwin.com
Subject: Re: Unconsistent command-line parsing in case of UTF-8 quoted arguments
Date: Sun, 11 Oct 2020 21:55:48 +0300	[thread overview]
Message-ID: <161053042.20201011215548@yandex.ru> (raw)
In-Reply-To: <CAFC9CLCR8ydf=JNkqUAHCU1DjUZi-xurV+ohuXM3Nfh-NaHf8A@mail.gmail.com>

Greetings, Jérôme Froissart!

> 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?

I would at least run it with LANG env. variable set.
F.e. LANG=ru_RU.UTF-8 in my case.
I further tweak it with
LC_MESSAGES=en_US.UTF-8
LC_NUMERIC=en_US.UTF-8

to get more consistent program output parsing experience.

>> 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

P.S.

I suggest
ln -fs /proc/cygdrive/c/Windows/System32/chcp.com /usr/local/bin/chcp


-- 
With best regards,
Andrey Repin
Sunday, October 11, 2020 21:51:57

Sorry for my terrible english...

  reply	other threads:[~2020-10-11 19:05 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-10-02 21:40 Jérôme Froissart
2020-10-03  2:22 ` Doug Henderson
2020-10-04 11:18 ` Andrey Repin
2020-10-06 21:36   ` Jérôme Froissart
2020-10-07  1:10     ` Andrey Repin
2020-10-07 22:21       ` Jérôme Froissart
2020-10-11 18:55         ` Andrey Repin [this message]
2020-10-07  2:20     ` Brian Inglis
2020-10-07  5:17     ` Thomas Wolff
2020-10-07 23:32       ` Brian Inglis
2020-10-08  0:59         ` Eliot Moss
2020-10-08  6:22           ` Brian Inglis
2020-10-13 16:30     ` Kaz Kylheku (Cygwin)
2020-10-14 21:47       ` Jérôme Froissart
2020-10-14 22:14         ` Jérôme Froissart
2020-10-15  5:14         ` UTF-8 quoted args passed to program include quotes when run from cmd Brian Inglis
2020-10-19  2:32         ` Unconsistent command-line parsing in case of UTF-8 quoted arguments Kaz Kylheku (Cygwin)
2020-10-13 17:34     ` Brian Inglis

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=161053042.20201011215548@yandex.ru \
    --to=anrdaemon@yandex.ru \
    --cc=cygwin@cygwin.com \
    --cc=software@froissart.eu \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).