X-Recipient: archive-cygwin AT delorie DOT com X-Spam-Check-By: sourceware.org Date: Mon, 21 Mar 2011 13:54:33 +0100 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: cygwin + GetConsoleOutputCP Message-ID: <20110321125433.GQ31220@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <4D8651F2 DOT 3000200 AT cwilson DOT fastmail DOT fm> <20110321111746 DOT GP31220 AT calimero DOT vinschen DOT de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , 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 Mar 21 12:37, Andy Koppe wrote: > On 21 March 2011 11:17, Corinna Vinschen wrote: > > to do the wrong thing anyway.  There are the following codepages available: > > > > - The current input console codepage, GetConsoleCP(). > > > > - The current output console codepage, GetConsoleOutputCP(). > > > > - The current OEM codepage, GetOEMCP(). > > > > - The current ANSI codepage, GetACP(). > > > > - The default OEM codepage of the default system locale, > >  GetLocaleInfo (LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTCODEPAGE, ...). > > > > - The default ANSI codepage of the default system locale, > >  GetLocaleInfo (LOCALE_SYSTEM_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, ...). > > > > - The default OEM codepage of the current user or process, > >  GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDEFAULTCODEPAGE, ...). > > > > - The default ANSI codepage of the current user or process, > >  GetLocaleInfo (LOCALE_USER_DEFAULT, LOCALE_IDEFAULTANSICODEPAGE, ...). > > > > - The default OEM codepage used for system invariant operations, > >  GetLocaleInfo (LOCALE_INVARIANT, LOCALE_IDEFAULTCODEPAGE, ...). > > > > - The default ANSI codepage used for system invariant operations, > >  GetLocaleInfo (LOCALE_INVARIANT, LOCALE_IDEFAULTANSICODEPAGE, ...). > > > > Which is the right one? > > GetACP(), which "retrieves the current Windows ANSI code page > identifier for the operating system". That's what programs using the > non-Unicode APIs get. It's also the default in Notepad and other > editors. If you convert *to* a Windows codepage, it's a good choice. If you convert *from* Windows you never know if the file in question has actually been stored in this codepage since you don't know of the the file hasn't been generated by another user using another codepage. Using GetACP() is ok, but it's still just guesswork. > Other code pages would need to be specified explicitly by the user. > > > > In theory the option is not useful and should just go away. If you > > have to keep it for backward compatibility, stick to the current > > behaviour and outlaw its use, perhaps be printing a nagging warning > > to stderr. > > ... and pointing them at iconv (which, to be fair, the -iso > description already does). And then there's the funny fact that a conversion iso-8859-1 to and from cp1252 is basically a no-op anyway. Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- 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