From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-lf1-x135.google.com (mail-lf1-x135.google.com [IPv6:2a00:1450:4864:20::135]) by sourceware.org (Postfix) with ESMTPS id 4ACAE386F41D for ; Thu, 12 Nov 2020 16:10:44 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 4ACAE386F41D Received: by mail-lf1-x135.google.com with SMTP id r9so9221739lfn.11 for ; Thu, 12 Nov 2020 08:10:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:to:from:subject:message-id:date:user-agent :mime-version:content-language:content-transfer-encoding; bh=rafUh48zf2p73gncZqNbPi3hNXNCu7LYHenvEU04VA8=; b=S6KOtVBehFI1Jv51IP6Hl9DH603p9qXveNanIOyD9nbNXYIcYs/lUfClmpo35r76gw kjyexWo7+n44BMhU/U9mTTvgWPoRMKvyBRoi4a+zFsGqLgyrkxAqCJQEbVeEeS2o6vob Ejm8PkdQ87Fyr8UELjS3MC0M1skR/WFOOLqGM2+MzsueysSs1vTajknCneyBZ/2PbYjR xSSewnI0VHL2V4jAjPD2XVLKR5jNBJefRv90N/vSx4VvgTyEYqIv/lye3JYL+Q+PpEIp oALt/hNmAO1nFMXJbG0wNNhxvLDa/11ENOBpYszT8GQJ71+lq/NUB8bapfeXcFH2JVpK kXVw== X-Gm-Message-State: AOAM532NMij99Zv8Q9ZPKz/NxNrdLyIAhqQGEjctzSJrcU98QA9hteqD sFtK6GZ0dw1hfiGqmVSv3uhQkYF8Daw= X-Google-Smtp-Source: ABdhPJyUkQ+ucndlvbSUjBELQZ9Bznm6V7wCeisc+IgdalwozG4t0qT4T4JCPWKyE5OCCKzPjha1uQ== X-Received: by 2002:a05:6512:3485:: with SMTP id v5mr13107816lfr.181.1605197442396; Thu, 12 Nov 2020 08:10:42 -0800 (PST) Received: from [192.168.1.152] ([94.229.108.206]) by smtp.googlemail.com with ESMTPSA id v195sm650765lfa.266.2020.11.12.08.10.40 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 12 Nov 2020 08:10:41 -0800 (PST) To: cygwin@cygwin.com From: basinilya@gmail.com Subject: surrounding double quotes not removed from native command line arguments when they contain unicode and locale is default Message-ID: <420b941a-8f6d-29a3-f97d-724025130ce7@gmail.com> Date: Thu, 12 Nov 2020 19:10:40 +0300 User-Agent: Mozilla/5.0 (Windows NT 6.1; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.4.1 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.6 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, FREEMAIL_FROM, RCVD_IN_DNSWL_NONE, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham 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: Thu, 12 Nov 2020 16:10:46 -0000 Hi. When I launch a Cygwin program from a native Windows program and an argument in the command line string is quoted and contains national characters then the Cygwin program behaves as if double quotes were part of the program argument. This happens if I don't explicitly set LC_ALL or if I set LC_ALL=C or set LC_ALL=C.UTF-8 This is a problem because arguments with spaces must be quoted. If I set the locale to some language and country the quotes are removed as expected no matter what code page I use, UTF-8 or a single-byte code page. The locale doesn't have to match the alphabet used. If the argument is not quoted or if it doesn't contain national characters then it works even with the C locale. C:\>set LC_ALL= C:\>C:/cygwin/bin/ls -l C:/test-z-я/some.txt -rw-r--r-- 1 il None 0 Nov 12 09:52 'C:/test-z-'$'/321/217''/some.txt' C:\>C:/cygwin/bin/ls -l "C:/test-z-я/some.txt" /usr/bin/ls: cannot access '"C:/test-z-'$'\321\217''/some.txt"': No such file or directory C:\>C:/cygwin/bin/ls -l "C:/test-z-Z/some.txt" -rw-r--r-- 1 il None 0 Nov 12 09:52 C:/test-z-Z/some.txt C:\>C:\cygwin\bin\locale LANG= LC_CTYPE="C.UTF-8" LC_NUMERIC="C.UTF-8" LC_TIME="C.UTF-8" LC_COLLATE="C.UTF-8" LC_MONETARY="C.UTF-8" LC_MESSAGES="C.UTF-8" LC_ALL= C:\>set LC_ALL=C.UTF-8 C:\>C:/cygwin/bin/ls -l "C:/test-z-я/some.txt" /usr/bin/ls: cannot access '"C:/test-z-я/some.txt"': No such file or directory C:\>set LC_ALL=en_US.CP1252 C:\>C:/cygwin/bin/ls -l "C:/test-z-я/some.txt" -rw-r--r-- 1 il None 0 Nov 12 09:52 'C:/test-z-'$'/030''N'$'/217''/some.txt' C:\>set LC_ALL=en_US.UTF-8 C:\>C:/cygwin/bin/ls -l "C:/test-z-я/some.txt" -rw-r--r-- 1 il None 0 Nov 12 09:52 'C:/test-z-я/some.txt'