Web lists-archives.com

Re: Quotes around command-line argument that has unicode characters are not removed




Greetings, Dmitry Katsubo!

>> Locale settings affecting Cygwin binary.
>> 
>> If you
>> set LANG=ru_RU.CP866
>> (f.e.)
>> before invoking cygwin testcase in native CMD, you will likely see it
>> working better.

> Thanks for this advise, Andrey. I see that it reacts, but works worth :)
> I think it advises to output characters in CP866, but console is UTF-8:

> D:\cli> set LANG=ru_RU.CP866

> D:\cli> test "текст плюс.txt"
> param 0 = test
> param 1 = ⥪▒▒ ▒▒▒▒.txt
> Failed to open '⥪▒▒ ▒▒▒▒.txt': No such file or directory

> But.. ta-da! I made it working like that:

> D:\cli> set LANG=ru_RU.UTF-8

> D:\cli> test "текст плюс.txt"
> param 0 = test
> param 1 = текст плюс.txt
> File 'текст плюс.txt' was opened

> Hooray, it worked!

This is no magic. Console settings must match locale set in the environment.
Please test again with "chcp" to get current console codepage and setting LANG to match it.
I could not see which version of Windows you're using, sorry. It is possible
that console is set to a different codepage than usual.

>> Alternatively, you could try
>> chcp 65001

> That does not help:

> D:\cli> chcp 65001
> Active code page: 65001

> D:\cli> test "текст плюс.txt"
> param 0 = test
> param 1 = "текст плюс.txt"
> Failed to open '"текст плюс.txt"': No such file or directory

> [1] https://github.com/openunix/cygwin/blob/master/winsup/cygwin/dcrt0.cc#L297
> [2] https://github.com/openunix/cygwin/blob/master/winsup/cygwin/dcrt0.cc#L165



-- 
With best regards,
Andrey Repin
Tuesday, March 27, 2018 12:51:10

Sorry for my terrible english...