Re: Glib: a Win32 discussion

2011/4/10 Tim Evans <t evans aranz com>:
> A combination of GetCommandLineW and CommandLineToArgvW can get you the
> arguments as wchar_t strings which could then be converted to utf8. Is this
> just something that glib needs to provide a convenience function for?
> g_win32_get_utf8_argv() maybe?

This is not about a convenience function. The real problem is that
GOption cannot parse UTF-8 argument lists. It will always consider the
argv to be in locale encoding, and the locale encoding cannot
accurately represent filenames on Windows. The input encoding for
GOption should be switchable at runtime.

Once GOption can parse UTF-8, the convenience function to get the
Unicode argv on Windows can be written. However, GetCommandLineW /
CommandLineToArgvW do not work, because globs are not expanded. You
need to use the function __wgetmainargs with glob expansion set to
true, the way it is used in glib/gspawn-win32-helper.c.

Regards, Krzysztof

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]