Mail Archives: cygwin/2009/05/08/23:43:48
(My system locale is zh_CN)
1, test path
>>> set LANG=& cygpath -am .
C:/Profiles/Shecti/桌面
>>> set LANG=zh_CN.GBK& cygpath -am .
C:/Profiles/Shecti/桌面
>>> set LANG=C& cygpath -am .
C:/Profiles/Shecti/×ÀÃæ
2, the `test' utility
>>> set LANG=& bash -c "D=$(cygpath -am .); if [ -d $D ]; then echo
ok $D; else echo fail $D; fi"
fail C:/Profiles/Shecti/桌面
>>> set LANG=zh_CN.GB2312& bash -c "D=$(cygpath -am .); if [ -d $D
]; then echo ok $D; else echo fail $D; fi"
fail C:/Profiles/Shecti/桌面
>>> set LANG=zh_CN.GBK& bash -c "D=$(cygpath -am .); if [ -d $D ];
then echo ok $D; else echo fail $D; fi"
ok C:/Profiles/Shecti/桌面
>>> set LANG=C& bash -c "D=$(cygpath -am .); if [ -d $D ]; then
echo ok $D;else echo fail $D; fi"
fail C:/Profiles/Shecti/×ÀÃæ
3, the `cp' utility
>>> set LANG=& bash -c "F=$(cygpath -am .)/a.zip; if cp -f $F xyz;
then echo ok $D; else echo fail $D; fi"
cp: cannot stat `C:/Profiles/Shecti/桌面/a.zip': No such file or
directory
fail
>>> set LANG=zh_CN.GB2312& bash -c "F=$(cygpath -am .)/a.zip; if cp
-f $F xyz; then echo ok $D; else echo fail $D; fi"
cp: cannot stat `C:/Profiles/Shecti/桌面/a.zip': No such file or
directory
fail
>>> set LANG=zh_CN.GBK& bash -c "F=$(cygpath -am .)/a.zip; if cp -f
$F xyz; then echo ok $D; else echo fail $D; fi"
ok
>>> set LANG=C& bash -c "F=$(cygpath -am .)/a.zip; if cp -f $F xyz;
then echo ok $D; else echo fail $D; fi"
cp: cannot stat `C:/Profiles/Shecti/×ÀÃæ/a.zip': No such file or
directory
fail
4, the `d' utility
>>> set LANG=& bash -c "D=$(cygpath -am .); if d $D; then echo ok
$D; else echo fail $D; fi"
/mnt/c/Profiles/Shecti/▒æ¡▒é¢/C:/Profiles/Shecti/桌面 doesn't exist!
fail C:/Profiles/Shecti/桌面
>>> set LANG=zh_CN.GB2312& bash -c "D=$(cygpath -am .); if d $D;
then echo ok $D; else echo fail $D; fi"
/mnt/c/Profiles/Shecti/▒æ¡▒é¢/C:/Profiles/Shecti/桌面 doesn't exist!
fail C:/Profiles/Shecti/桌面
>>> set LANG=zh_CN.GBK& bash -c "D=$(cygpath -am .); if d $D; then
echo ok $D; else echo fail $D; fi"
/mnt/c/Profiles/Shecti/▒æ¡▒é¢/C:/Profiles/Shecti/桌面 doesn't exist!
fail C:/Profiles/Shecti/桌面
>>> set LANG=C& bash -c "D=$(cygpath -am .); if d $D; then echo ok
$D; elseecho fail $D; fi"
/mnt/c/Profiles/Shecti/▒æ¡▒é¢/C:/Profiles/Shecti/×ÀÃæ doesn't exist!
fail C:/Profiles/Shecti/×ÀÃæ
Problems:
(1)
Executables `test', `cp' (and rm, cat, stat, find, etc. seems like
all of binutils) supports locale settings,
while `d' (and gcc, zip, unzip, gzip, gunzip, jar, vi, etc. not of
binutils) are not.
(2)
Even programs of binutils may not support locale settings correctly,
The GB2312 charset is a subset of GBK charset, and the characters `
桌面' is included in GB2312 charset. So in this example, GB2312 SHOULD WORK.
--
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
Problem reports: http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ: http://cygwin.com/faq/
- Raw text -