This is the mail archive of the cygwin mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

command line argument parsing get extra ^X for Chinese characters when started from native win app


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
==[ to get actual wrong output ]
c:\app\cygwin\bin\env LANG=zh_CN.UTF-8 PATH=/usr/bin bash -c "echo äæ;
echo äæ > a.txt; cat a.txt; xxd a.txt; echo please vim a.txt; sh"
===============

==[  actual output ]
 ä æ
 ä æ
0000000: 18e4 b8ad 18e6 9687 0a                   .........
please vim a.txt
sh-4.1$
===============
now when you do "vim a.txt", you see
a.txt
^Xä^Xæ

copy and paste the code to mintty. with mintty encoding set to UTF-8
==[ code to get correct expected output ]
echo äæ; echo äæ > a.txt; cat a.txt; xxd a.txt; echo please vim a.txt
===============

==[  expected output ]
äæ
äæ
0000000: e4b8 ade6 9687 0a                        .......
please vim a.txt
===============
now when you do "vim a.txt", you see
a.txt
äæ






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

Attachment: a.bat.txt
Description: Text document

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

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]