Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!feeder.erje.net!eu.feeder.erje.net!fu-berlin.de!uni-berlin.de!news.dfncis.de!not-for-mail From: =?ISO-8859-1?Q?Sven_K=F6hler?= Newsgroups: comp.lang.java.programmer Subject: Re: exec problem is JDK 1.7.0_21 Date: Wed, 24 Apr 2013 09:29:35 +0300 Lines: 48 Message-ID: References: Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit X-Trace: news.dfncis.de fli1cXewt3Bu0PWz/fDAXQZrnkaxDfrXrgFNp0ehlzHgNs9QNdTxmDGtw1 Cancel-Lock: sha1:Q+iiy7wLh1GVuatd0ncFlQWR+jQ= User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130408 Thunderbird/17.0.5 In-Reply-To: Xref: csiph.com comp.lang.java.programmer:23611 Am 24.04.2013 01:39, schrieb Steven Simpson: >> Also, you have to add another backslash if the quote does not terminate >> the argument. > > Again, I took it to mean that the first two rules produce the same > result, so \\\" and \\" both produce \". The documentation of CommandLineToArgv is incomplete. \\" produces a single backslash, and the quote is the closing quote. \" and \\\" produce a non-closing quote resp. a backslash followed by a non-closing quote. >> Here's my attempt to the do the escaping: >> http://sourceforge.net/p/lejos/code/HEAD/tree/trunk/org.lejos.nxt.ldt/src/main/java/org/lejos/nxt/ldt/util/LeJOSNXJUtil.java#l421 >> > > I haven't looked in detail at it, but do note your comment: >> * How decoding works: >> * 2n backslashes + quote => n backslashes + closing quote >> * 2n+1 backslashes + quote => n backslashes + inner quote >> * n backslashes not followed by a quote => n backslashes > > From > > (with my emphasis): >> >> * 2/n/ backslashes followed by a quotation mark produce /n/ >> backslashes followed by a quotation mark. >> * (2/n/) + 1 backslashes followed by a quotation mark *again* >> produce /n/ backslashes followed by a quotation mark. >> * /n/ backslashes not followed by a quotation mark simply produce >> /n/ backslashes. >> >> > > Where are you getting the notion that the first two rules imply > different quotes? I interpret both as being literal (inner, right?). Well, by testing. As you can test yourself on the command line, \\" will result in a closing quote and \" and \\\" will result in non-closing quotes. Also, there HAS to be a way to distinguish a closing vs. a non-closing quote. Otherwise you wouldn't know whether the quotes in \" \\" and \\\" were closing or not. That's it is not documented is just a real shame! Regards, Sven