Web lists-archives.com

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




On 2018-03-27 03:56, Andrey Repin wrote:
>>> 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


If you're using cmd you can also set AutoRun commands like:

	$ cat HKCU-SW-MS-Command_Processor-AutoRun-chcp_65001.reg
	Windows Registry Editor Version 5.00

	[HKEY_CURRENT_USER\Software\Microsoft\Command Processor]
	"AutoRun"="@chcp 65001 >nul"


- append " && command..." to add more commands to AutoRun; these must use only
the common base characters.

-- 
Take care. Thanks, Brian Inglis, Calgary, Alberta, Canada

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