Windows console is broken

Sergey Gromov snake.scaly at gmail.com
Wed Jan 30 18:53:08 PST 2008


Sean Kelly Wrote:
> Sergey Gromov wrote:
> > If a command-line argument to a D program contains a non-ascii
> > character, that argument doesn't get into main().  This happens even
> > if console code page is 65001.  This is most annoying because it
> > cannot be worked around.
> 
> This has worked properly in Tango since its release over a year ago.

Thanks for mentioning Tango, I've tried it and it really worked both
in and out.  Though it would be nice to have the correct command line
handling in the official distribution.  The command line is parsed in application
startup code, OS is known, API is there, and there's no performance hit.

> > All in all, when it comes to simple utilities, I just put D aside and
> > switch to batch/C/perl/whatever.  As it said in Phobos's Philosophy,
> > "Simple Operations should be Simple."  I don't need a standard
> > output that doesn't work.
> 
> Personally, I feel that for scripting-type applications, the best
> solution may be to build a custom wrapper around the standard library
> which provides the utmost in convenience with no concern for efficiency.
>  We've actually talked about this in relation to Tango, but it would
> mean yet another API for people to learn and even more code to maintain.

If stdout were a bit more than _iobuf, it would be possible to replace it
with a more sophisticated stream aware of the nature of the console.
But it's essentially only a Posix file handle, and Windows doesn't allow
for custom streams.

>  Perhaps this would be a good third-party project for someone so inclined?

It feels somewhat wrong to use a custom library for a one-file utility.
But I'll probably try.



More information about the Digitalmars-d mailing list