Windows console is broken
Sergey Gromov
snake.scaly at gmail.com
Thu Jan 31 09:20:35 PST 2008
Vladimir Panteleev Wrote:
> On Thu, 31 Jan 2008 01:30:48 +0200, Sergey Gromov <snake.scaly at gmail.com> wrote:
> > If a command-line argument to a D program contains a non-ascii
> > character, that argument doesn't get into main().
> If I understood your problem correctly, here's a workaround:
>
> import std.windows.charset, std.string;
> import std.file;
>
> void main(char[][] args)
> {
> // convert from MBS (Windows ANSI encoding) to UTF-8
> foreach(ref arg;args)
> arg = fromMBSz(toStringz(arg));
>
> write(args[1], "Hello international world!");
> }
Unfortunately, there is no workaround:
import std.stdio;
void main(string[] args)
{
writeln("Number of arguments to main: ", args.length);
}
>example ÜÐÜÐ ßÐßÐ
Number of arguments to main: 1
>example mother father
Number of arguments to main: 3
You can do nothing about arguments which are not there.
SnakE
More information about the Digitalmars-d
mailing list