From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) by sourceware.org (Postfix) with ESMTPS id B83323851C2A for ; Wed, 7 Oct 2020 22:21:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org B83323851C2A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=froissart.eu Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=jerome.froissart@gmail.com Received: by mail-ej1-f48.google.com with SMTP id ce10so5196063ejc.5 for ; Wed, 07 Oct 2020 15:21:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc:content-transfer-encoding; bh=aUjDf4MaE0lJdPRJ2j2BPZKIat3BwtX4aSYrmUpe7eg=; b=OS1P1DSY4Rwwh66B2pSnKtUH3f+WxbOQPr11/9K8kiCh9Yt5HYPxs/5YRAc1U5pXlt hrcbp7GJ5Hoc/E6N/NCn2AxvCKEwO2vxHbJlGEGGtGj5ldojPZ1AUWXI1rqfxCbUTerF FYfFa3jvrwhCmbrvAlO0mdwSHCX8MOq34sQrdcCETv7KDDcVfkdzf7H1QcGeSh5/R7sE t0RIIoLBTqPqYvkDeyTU86nRbkkI74iUY86RVP0wDQCas6iLgFuENupdhZszJ3cEzBLz 68VeyhGEyn8SStFI0AGgjRjxT6mXIpP+ySYPh+g/ZEYI9/fS4+NSH/Fe/wk04Q+DTebu 9uyg== X-Gm-Message-State: AOAM5319JdyWEN02kVtk3+bpo7RKoOEHGuJf1eIJ0O0IYYBAH1jKGiEI oDDR9uklNCOWY8k6YDnIU6MF3LamKhV9YYQpOg39mnOw X-Google-Smtp-Source: ABdhPJww/WfistWSsOg527gJXcJPMNigEB2T5AogdPhGzBeiqxsvQIu8uRGs4BjhZC30TnOSSdlMnuJ8PeQqd7dk1sU= X-Received: by 2002:a17:906:c10c:: with SMTP id do12mr5450316ejc.527.1602109304475; Wed, 07 Oct 2020 15:21:44 -0700 (PDT) MIME-Version: 1.0 References: <634821436.20201004141809@yandex.ru> <1094935297.20201007041019@yandex.ru> In-Reply-To: <1094935297.20201007041019@yandex.ru> From: =?UTF-8?B?SsOpcsO0bWUgRnJvaXNzYXJ0?= Date: Thu, 8 Oct 2020 00:21:34 +0200 Message-ID: Subject: Re: Unconsistent command-line parsing in case of UTF-8 quoted arguments To: cygwin@cygwin.com Cc: =?UTF-8?B?SsOpcsO0bWUgRnJvaXNzYXJ0?= Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, RCVD_IN_DNSWL_NONE, 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@cygwin.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: , X-List-Received-Date: Wed, 07 Oct 2020 22:21:47 -0000 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 c= alled > 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=C3=A9r=C3=B4me