Setup and Mintty

Andy Koppe andy.koppe@gmail.com
Sat Nov 19 09:58:00 GMT 2011


On 18 November 2011 21:11, Thomas Wolff wrote:
> Am 18.11.2011 11:59, schrieb Corinna Vinschen:
>>
>> On Nov 18 05:36, Andy Koppe wrote:
>>>
>>> On 17 November 2011 17:17, Corinna Vinschen wrote:
>>> ...
>>>>
>>>> Is there anything else missing?
>>>
>>> I suspect the manual and FAQ need a few tweaks.
>>
>> There's the faq entry "My application prints international characters
>> but I only see gray boxes".  The entry about the console is still
>> valid, even after changing to mintty on the desktop.  Do you think
>> it makes sense to add words about mintty here?  If so, I guess the
>> problem more often occurs with Win32 apps running in a UTF-8 mintty.
>> Do you have a suggestion for an addition related to mintty?
>
> This problem could at least be partially solved as has been discussed in
> http://www.cygwin.com/ml/cygwin-apps/2010-06/msg00033.html:
> test case:
>
> touch bäh
> cmd /c dir
> chcp 65001 (or cmd /c chcp 65001) <- the corresponding API call could be
> issued by mintty, or cygwin1.dll
> cmd /c dir

Unfortunately that can't be done by mintty, because the SetConsoleCP()
API requires the calling process to be connected to a console, but
mintty doesn't have one. The hidden console is only created when
mintty's child process calls exec() to start the shell, and of course
that doesn't return unless it fails.

So short of duplicating the Cygwin DLL's hidden console magic in
mintty, I see the following possibilities:

- Implement the codepage setting as part of the hidden console magic.
This would require a mapping of each Cygwin charset to the most
closely matching codepage.
- Make the hidden console magic available separately from exec(), e.g.
through cygwin_internal(), so that the mintty child process can invoke
that, followed by SetConsoleCP() and exec(). (Mintty already has the
necessary charset-to-codepage mapping.)
- Implement a utility that does the charset mapping and codepage
setting, and invoke that from shell startup scripts.

Andy



More information about the Cygwin-apps mailing list