ssh-host-config produces Win32 error 1057 on systems with non-ASCII computer names
Wed Mar 6 13:09:00 GMT 2013
On 2013-03-06 13:25, Corinna Vinschen wrote:
> On Mar 6 13:11, Johan Ehnberg wrote:
>> On 2013-03-06 12:39, Corinna Vinschen wrote:
>>> This is the fault of the cygrunsrv tool, which still uses the
>>> ANSI variants of the Win32 API. The default codeset under Cygwin
>>> is UTF-8, but that doesn't match your Windows ANSI codepage 1252,
>>> so that's what probably goes wrong.
>>> Cygrunsrv has to be changed to use the UNICODE variants of the
>>> Windows Service API to get that working.
>> Thank you for the prompt answer, it seems to be just on the spot.
>> For future reference, the default codepage for this Windows variant,
>> as reported by chcp, is 850.
> Hang on. This is the default OEM codepage, not the default ANSI
> codepage. The OEM codepage is what CMD uses, the ANSI codepage is what
> Explorer and other GUI tools and especially the Win32 ANSI API uses by
>> Using codepage 1252 works mostly, but
>> will garble up cmd with some characters and may cause trouble in
>> batch scripts with non-ASCII characters.
> What you can try is this: Start mintty, open the Options dialog,
> and set your Locale to the POSIX "fi_FI" and the charcter set to
> "CP1252". Store the result, close mintty and start it again.
> Now your Cygwin tools will use the same codeset as the Windows ANSI
> API. Now try ssh-host-config again. In theory, that should work.
>> Interestingly, Notepad does
>> not support codepage 850 but uses codepage 1252 on the same system.
>> This can fool the user and mess up scripts after edits.
>> On the other hand, I have understood that Windows is also known for
>> not running Unicode batch scripts properly - changing cygrunsrv
>> alone may not yet solve this for automated batch script
> Yes it will. Cygwin tools use the Cygwin codeset as defined by
> the $LANG environment variable.
Thank you for the correction. As you probably noticed, my perspective on
this is purely scripting and automation i.e. neiter me nor the users
should need to work within the cygwin environment. As such, I am
primarily concerned with whatever codepage CMD uses by default and
actually the scripts I use set the codepage to 850 even if it has been
changed, so as not to brake the commands but potentially at the cost of
garbled output messages.
When Windows uses something else elsewhere, I can only adjust to that as
far as scripting allows. In other words, changing the mintty environment
won't help in this use case. Unless of course it can be done via command
line both for the mintty environment and for CMD running the script.
When I researched into that earlier, it did not seem possible, but it
would add value for secondary uses of the cygwin environment.
In a perfect (utopistic) world, everyone would quickly settle on
something like UTF-8 and we could all spend our time on the actual task
at hand :)
Anyway I am trailing off from the original issue of ssh-host-config and
Win32 situation out of the box. I am grateful for the ideas and
knowledge that you shared!
Problem reports: http://cygwin.com/problems.html
Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple
More information about the Cygwin