delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2010/02/19/15:29:40

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-2.0 required=5.0 tests=AWL,BAYES_00,SARE_MSGID_LONG40,SPF_PASS
X-Spam-Check-By: sourceware.org
MIME-Version: 1.0
In-Reply-To: <c6fsn5ln6bdtgr86bp3ri44ui48kf57ica@4ax.com>
References: <t94sn59ntooeal9hc0a25hkk7ntphg99cf AT 4ax DOT com> <c6fsn5ln6bdtgr86bp3ri44ui48kf57ica AT 4ax DOT com>
Date: Fri, 19 Feb 2010 20:29:27 +0000
Message-ID: <416096c61002191229x670cbb63gf5c693056af727a2@mail.gmail.com>
Subject: Re: 1.7.1: unable to run the a bash script resides in chinese path using: c:\cygwin\bin\bash --login script.
From: Andy Koppe <andy DOT koppe AT gmail DOT com>
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Unsubscribe: <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

Hongyi Zhao:
> C:\cygwin\bin\bash --login "%~dp0myscript"
> ...
> Preferred POSIX equivalent is: "F:/zhaohs/Desktop/=E9=8F=82=E7=89=88=E7=
=85=A1=E9=8F=82=E5=9B=A9=E5=B0=9E/myscript"
> ...
> /usr/bin/bash: "F:\zhaohs\Desktop\=E6=96=B0=E6=9F=A5=E6=96=87=E7=8C=AE\my=
script": No such file or
directory

Looks like there's some sort of GBK vs UTF-8 mixup going on, because
'=E9=8F=82=E7=89=88=E7=85=A1=E9=8F=82=E5=9B=A9=E5=B0=9E' is the same byte s=
equence in GBK as '=E6=96=B0=E6=9F=A5=E6=96=87=E7=8C=AE' is in UTF-8:
\xE6\x96\xB0\xE6\x9F\xA5\xE6\x96\x87\xE7\x8C\xAE

I take it the actual directory name is '=E6=96=B0=E6=9F=A5=E6=96=87=E7=8C=
=AE'? (Babelfish seems to be
able to make some sense of that one but not the other.)

Do you know what the encoding of your batch file is? And have you got
any locale variables (LC_ALL, LC_CTYPE, LANG) set when invoking it?


>>@echo off
>>C:\cygwin\bin\bash --login "%~dp0myscript"
>
> I've found a more strange thing: If I change the batch file into the
> following form, then it will be run smoothly:
>
> @echo off
> C:\cygwin\bin\bash --login %~dp0myscript
>
> The QUOTATION MARK in the former is used to deal with the whitespaces
> appearing in the myscript's pathname, though this is relatively rare
> case. =C2=A0But in the latter case, if there're whitespaces in the
> myscript's pathname, the batch will fail to run.

Hmm, perhaps the argument mangling at program startup is using the
ANSI codepage (i.e. GBK in this case) when it should be using UTF-8?

Andy

--
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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019