Skip to content

ArgIteratorWindows uses non-Unicode GetCommandLineA and a custom parser #2222

Description

@ljmccarthy

std.os.ArgIteratorWindows currently uses GetCommandLineA which doesn't support Unicode and implements it's own command line parser.

I'm sure it's a good parser, but there is already a Windows function to implement this called CommandLineToArgvW which can be used with the result of GetCommandLineW. I would suggest that using this instead would make sure that Zig doesn't parse command-lines differently to regular C/C++ programs on Windows and would reduce code size.

I have implemented a proof-of-concept using these Win32 functions, returning an array of UTF-8 strings:

https://gist.github.com/ljmccarthy/4f372f060d2d2e11b594ad9188fd4720

I'm also not a big for of the ArgIterator interface, which is rather painful to use, but I will create a separate issue for that :-)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    contributor friendlyThis issue is limited in scope and/or knowledge of Zig internals.os-windowsMicrosoft Windowsstandard libraryThis issue involves writing Zig code for the standard library.

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions