www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/12/24/02:37:27

X-Recipient: archive-cygwin AT delorie DOT com
DomainKey-Signature: a=rsa-sha1; c=nofws; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; q=dns; s=default; b=jFUVS7MyglViNhz1BmmXX98Cu2E2K
PUDk+9owig/CqqSKPb54BdMyE31XEyL+aqNC+FYTy2A52GZTizglzalMNHTD51eG
CBjVB3UIW4ZCbmgQQCTAwqBuWGKf0neLwMVEcjgZzuKyoKdvYpisXvHYzb1JcO9S
SwgVm0pTwgz10M=
DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=sourceware.org; h=list-id
:list-unsubscribe:list-subscribe:list-archive:list-post
:list-help:sender:mime-version:from:date:message-id:subject:to
:content-type; s=default; bh=Ju4i9HgAtg6UUl3wSghRWqEJWrU=; b=XnV
EJBQXZED6RnK3dlltF6lKHHK5xCTn6NP96mYfv9hIAbikJfKE3X0jiCNaK2Ef7BE
hVA5Xydh3vC0Hwe3M81GTanvTXfBunbGlH4EMAJPJOr7+vHFAApagGm/CyIVAJQa
Y86T6ymBId1oOnyEcfQN+0cgMM15dWqBPHRCivAc=
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.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
Authentication-Results: sourceware.org; auth=none
X-Virus-Found: No
X-Spam-SWARE-Status: No, score=4.2 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,GARBLED_BODY,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2
X-HELO: mail-we0-f175.google.com
X-Received: by 10.180.188.197 with SMTP id gc5mr22159397wic.42.1387870621048; Mon, 23 Dec 2013 23:37:01 -0800 (PST)
MIME-Version: 1.0
From: Xuefer <xuefer AT gmail DOT com>
Date: Tue, 24 Dec 2013 15:36:40 +0800
Message-ID: <CAMs-qv9Lk1a8K6b_bJ3a_EBRxSXo32N69+f934oWD7pk3wrWLA@mail.gmail.com>
Subject: command line argument parsing get extra ^X for Chinese characters when started from native win app
To: cygwin AT cygwin DOT com
X-IsSubscribed: yes

--001a11c3841a5cb90004ee42cfaa
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: quoted-printable

tested with
$ uname -a
CYGWIN_NT-6.1 mOo-PC 1.7.27(0.271/5/3) 2013-12-09 11:54 x86_64 Cygwin

run the following code in .bat file, the file should be in GBK
encoding. as your system should be GBK encoding by default to parse
the batch file correctly
or copy paste the code to start->run
=3D=3D[ to get actual wrong output ]
c:\app\cygwin\bin\env LANG=3Dzh_CN.UTF-8 PATH=3D/usr/bin bash -c "echo =E4=
=B8=AD=E6=96=87;
echo =E4=B8=AD=E6=96=87 > a.txt; cat a.txt; xxd a.txt; echo please vim a.tx=
t; sh"
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=3D=3D[  actual output ]
 =E4=B8=AD =E6=96=87
 =E4=B8=AD =E6=96=87
0000000: 18e4 b8ad 18e6 9687 0a                   .........
please vim a.txt
sh-4.1$
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
now when you do "vim a.txt", you see
a.txt
^X=E4=B8=AD^X=E6=96=87

copy and paste the code to mintty. with mintty encoding set to UTF-8
=3D=3D[ code to get correct expected output ]
echo =E4=B8=AD=E6=96=87; echo =E4=B8=AD=E6=96=87 > a.txt; cat a.txt; xxd a.=
txt; echo please vim a.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D

=3D=3D[  expected output ]
=E4=B8=AD=E6=96=87
=E4=B8=AD=E6=96=87
0000000: e4b8 ade6 9687 0a                        .......
please vim a.txt
=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D
now when you do "vim a.txt", you see
a.txt
=E4=B8=AD=E6=96=87






a.bat is provided as attachment in text, not sure if accepted by this
mailing list system.

--001a11c3841a5cb90004ee42cfaa
Content-Type: text/plain; charset=US-ASCII; name="a.bat.txt"
Content-Disposition: attachment; filename="a.bat.txt"
Content-Transfer-Encoding: base64
X-Attachment-Id: f_hpku9jvr0

YzpcYXBwXGN5Z3dpblxiaW5cZW52IExBTkc9emhfQ04uVVRGLTggUEFUSD0v
dXNyL2JpbiBiYXNoIC1jICJlY2hvINbQzsQ7IGVjaG8g1tDOxCA+IGEudHh0
OyBjYXQgYS50eHQ7IHh4ZCBhLnR4dDsgZWNobyBwbGVhc2UgdmltIGEudHh0
OyBzaCINCg==


--001a11c3841a5cb90004ee42cfaa
Content-Type: text/plain; charset=us-ascii

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

- Raw text -


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