X-Recipient: archive-cygwin AT delorie DOT com DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50A7C385703A DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cygwin.com; s=default; t=1602443109; bh=wZ8vpt96ywT2t5BapJRr/88jyBix/BZc5KYbMGlh4zw=; h=Date:To:Subject:In-Reply-To:References:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=ZKabRazFruDGgF4H4x1sn5wNkgObXcSUQsQ51hqr0dQJF6SMO7j+DO177z1KQ424f KHbyFx23Y7S+oOfxejCEpt5P2C/mkvd1N/bxKv9HmcbQjzcdE7gR+8DJvE4+NPGD68 2E3g33ICPPjj4XUUjdZycibbqc9nu4oT+OQUN8lw= X-Original-To: cygwin AT cygwin DOT com Delivered-To: cygwin AT cygwin DOT com DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B16653857C4E Date: Sun, 11 Oct 2020 21:55:48 +0300 X-Mailer: The Bat! (v6.8.8) Home X-Priority: 3 (Normal) Message-ID: <161053042.20201011215548@yandex.ru> To: =?utf-8?Q?J=C3=A9r=C3=B4me_Froissart?= , cygwin AT cygwin DOT com Subject: Re: Unconsistent command-line parsing in case of UTF-8 quoted arguments In-Reply-To: References: <634821436 DOT 20201004141809 AT yandex DOT ru> <1094935297 DOT 20201007041019 AT yandex DOT ru> MIME-Version: 1.0 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, KAM_THEBAT, NICE_REPLY_A, RCVD_IN_DNSWL_LOW, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=no autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: cygwin AT cygwin DOT com X-Mailman-Version: 2.1.29 Precedence: list List-Id: General Cygwin discussions and problem reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , From: Andrey Repin via Cygwin Reply-To: cygwin AT cygwin DOT com Cc: Andrey Repin Content-Type: text/plain; charset="utf-8" Errors-To: cygwin-bounces AT cygwin DOT com Sender: "Cygwin" Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by delorie.com id 09BJ5bDa020039 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... -- Problem reports: https://cygwin.com/problems.html FAQ: https://cygwin.com/faq/ Documentation: https://cygwin.com/docs.html Unsubscribe info: https://cygwin.com/ml/#unsubscribe-simple