Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Erwin Waterlander
On 03/21/2011 03:46 PM, Charles Wilson wrote: Hmm. So we have a choice for the cygwin version, for choosing the default dos cp when the user specifies -iso and doesn't explicitly specify the cp: either 1) follow the unix behavior: just simply default to -437. 2) follow the dos behavior: use

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Charles Wilson
On 3/21/2011 9:47 AM, Erwin Waterlander wrote: > I was doubting between GetACP and GetConsoleOutputCP on Windows. On a > Western regional Windows the format of a text file is most likely CP1252. > But the tool is named *dos*2unix, not *windows*2unix, therefore my > choice was GetConsoleOutputCP. T

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Charles Wilson
On 3/21/2011 3:53 AM, Andy Koppe wrote: > I think defaulting to the console codepage makes sense for the DOS > side of the conversion. Having said that, Windows files that aren't > "Unicode", i.e. UTF-16, are usually encoded in the so-called ANSI > codepage, e.g. CP1252, so it would make more sense

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Erwin Waterlander
On 03/21/2011 01:37 PM, Andy Koppe wrote: On 21 March 2011 11:17, Corinna Vinschen wrote: Well, I'm not sure about that. The complexity of codepage settings on a Windows system makes the whole afair a guesswork which will always tend to do the wrong thing anyway. There are the following codepa

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Corinna Vinschen
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(). > >

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Andy Koppe
On 21 March 2011 11:17, Corinna Vinschen wrote: > On Mar 21 07:53, Andy Koppe wrote: >> On 20 March 2011 19:13, Charles Wilson wrote: >> > So basically if you specify -iso (or --conv iso) without any of the >> > "input encoding specification" options like -437 etc, then dos2unix will >> > autodetec

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Corinna Vinschen
On Mar 21 07:53, Andy Koppe wrote: > On 20 March 2011 19:13, Charles Wilson wrote: > > So basically if you specify -iso (or --conv iso) without any of the > > "input encoding specification" options like -437 etc, then dos2unix will > > autodetect attempt to detect the *console* encoding.  If it suc

Re: cygwin + GetConsoleOutputCP

2011-03-21 Thread Andy Koppe
On 20 March 2011 19:13, Charles Wilson wrote: > Question about porting the upstream "dos2unix" utilities.  These > implementations provide capabilities to convert text files from a > certain limited set of INPUT encodings (most are DOS codepages): > > ===

Re: cygwin + GetConsoleOutputCP

2011-03-20 Thread Thomas Wolff
echanism (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 sp

cygwin + GetConsoleOutputCP

2011-03-20 Thread Charles Wilson
Question about porting the upstream "dos2unix" utilities. These implementations provide capabilities to convert text files from a certain limited set of INPUT encodings (most are DOS codepages): = CONVERSION MODES Conversion modes ascii,