delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin/2011/03/20/18:23:02

X-Recipient: archive-cygwin AT delorie DOT com
X-SWARE-Spam-Status: No, hits=-1.2 required=5.0 tests=AWL,BAYES_05,RCVD_IN_DNSWL_NONE,SPF_HELO_PASS
X-Spam-Check-By: sourceware.org
Message-ID: <4D867E08.7020208@towo.net>
Date: Sun, 20 Mar 2011 23:22:00 +0100
From: Thomas Wolff <towo AT towo DOT net>
Reply-To: Thomas Wolff <towo AT towo DOT net>
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; de; rv:1.9.2.15) Gecko/20110303 Lightning/1.0b2 Thunderbird/3.1.9
MIME-Version: 1.0
To: cygwin AT cygwin DOT com
Subject: Re: cygwin + GetConsoleOutputCP
References: <4D8651F2 DOT 3000200 AT cwilson DOT fastmail DOT fm>
In-Reply-To: <4D8651F2.3000200@cwilson.fastmail.fm>
X-TagToolbar-Keys: D20110320232200021
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

Am 20.03.2011 20:13, schrieb Charles Wilson:
> ...
>
> Note that this autodetect, if it works, assumes that the console's CP is
> the input file's CP.  Fair enough -- and it's an overridable default
> anyway.  However, I wonder if, in cygwin-1.7, we actually can/should use
> the "console codepage" in ANY way.  Here's the code:
>
> querycp.c:
> #elif defined (WIN32) || defined(__CYGWIN__)
>
> /* Erwin Waterlander */
>
> #include<windows.h>
> unsigned short query_con_codepage(void) {
>     return((unsigned short)GetConsoleOutputCP());
> }
> #else
>
> Or if instead, on cygwin, we should use some other mechanism (locale
> settings?) to determine the correct default "input" codepage.
>
> Comments?
On cygwin, GetConsoleOutputCP is largely irrelevant and is actually 
*not* the console's "codepage" for cygwin programs.
Therefore, defined (WIN32) and defined (__CYGWIN__) should be split and 
either setlocale or nl_langinfo should be used.

Thomas

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