public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Thomas Wolff <towo@towo.net>
To: cygwin@cygwin.com
Subject: Re: Quotes around command-line argument that has unicode characters are not removed
Date: Fri, 23 Mar 2018 07:58:00 -0000	[thread overview]
Message-ID: <80cca6dd-f7a7-3dda-9c95-8bfb9e97956d@towo.net> (raw)
In-Reply-To: <1547310513.20180322142446@yandex.ru>

Am 22.03.2018 um 12:24 schrieb Andrey Repin:
> ...
>> when I put quotes around file that has
>> non-ASCII symbols, these quotes are passed to argv of the process literally,
>> otherwise they are removed. I would expect that there is a consistency.
> Parameter unquoting done by the shell.
> CMD does that differently from POSIX shells.
cmd.exe applies some inconsistent "smart" (in an MS sense...) magic 
quoting; it adds additional quotes if the parameter contains non-ASCII 
characters.
>> I have written a small C program that displays arguments, and run it three times:
> ...
You can also test this with cygwin /bin/echo:
C:\cygwin\bin>.\echo "bla"
bla

C:\cygwin\bin>.\echo "blö"
"blö"

This is also the reason why 'chere' fails on non-ASCII directories.

>> As one can see, the last run fails. I am a bit puzzled: how can I pass the name
>> of the file with space and Unicode symbols? I need to do it in uniform way, as I
>> am calling a Cygwin program from native Windows program, as in [1].
Due to the weird cmd.exe behaviour, you cannot. However, cygwin could 
apply a workaround by magic unquoting.

Thomas

>> Any feedback is appreciated.
>> [1] https://sourceware.org/ml/cygwin/2016-05/msg00082.html
>> [2] http://daviddeley.com/autohotkey/parameters/parameters.htm
>> [3] https://cygwin.com/cygwin-ug-net/using-specialnames.html#pathnames-at
>> [4] https://github.com/openunix/cygwin/blob/master/winsup/cygwin/dcrt0.cc#L177

--
Problem reports:       http://cygwin.com/problems.html
FAQ:                   http://cygwin.com/faq/
Documentation:         http://cygwin.com/docs.html
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple

  parent reply	other threads:[~2018-03-23  7:39 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-03-22  5:41 Dmitry Katsubo via cygwin
2018-03-22 12:24 ` Andrey Repin
2018-03-22 17:25   ` Kaz Kylheku
2018-03-22 22:46     ` Dmitry Katsubo via cygwin
2018-03-25  0:04       ` Kaz Kylheku
2018-03-22 21:14   ` Dmitry Katsubo via cygwin
2018-03-23  7:58   ` Thomas Wolff [this message]
2018-03-23 12:20     ` Steven Penny
2018-03-22 13:35 ` Mikhail Usenko via cygwin
2018-03-22 15:35   ` Andrey Repin
2018-03-22 22:21     ` Dmitry Katsubo via cygwin
2018-03-27 10:05       ` Andrey Repin
2018-03-27 17:39         ` 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=80cca6dd-f7a7-3dda-9c95-8bfb9e97956d@towo.net \
    --to=towo@towo.net \
    --cc=cygwin@cygwin.com \
    /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).