delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2013/03/06/08:09:52

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.1 required=5.0 tests=AWL,BAYES_00,KHOP_THREADED
X-Spam-Check-By: sourceware.org
Message-ID: <51373FD7.9030201@ehnberg.net>
Date: Wed, 06 Mar 2013 15:08:39 +0200
From: Johan Ehnberg <johan AT ehnberg DOT net>
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:17.0) Gecko/20130221 Thunderbird/17.0.3
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: ssh-host-config produces Win32 error 1057 on systems with non-ASCII computer names
References: <513719BE DOT 4030004 AT ehnberg DOT net> <20130306103939 DOT GF14373 AT calimero DOT vinschen DOT de> <5137244E DOT 5030809 AT ehnberg DOT net> <20130306112548 DOT GF25458 AT calimero DOT vinschen DOT de>
In-Reply-To: <20130306112548.GF25458@calimero.vinschen.de>
X-Spam-Scanned: Scanned at neoisis.net
X-Spam-Score: -4.4
X-Spam-Score-Int: -43
X-IsSubscribed: yes
Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm
List-Id: <cygwin.cygwin.com>
List-Subscribe: <mailto:cygwin-subscribe AT cygwin DOT com>
List-Archive: <http://sourceware.org/ml/cygwin/>
List-Post: <mailto:cygwin AT cygwin DOT com>
List-Help: <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs>
Sender: cygwin-owner AT cygwin DOT com
Mail-Followup-To: cygwin AT cygwin DOT com
Delivered-To: mailing list cygwin AT cygwin DOT com

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
> default.
>
>> 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
>> installations?
>
> Yes it will.  Cygwin tools use the Cygwin codeset as defined by
> the $LANG environment variable.
>
>
> Corinna
>

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!

Best regards,
Johan

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

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019