Hey, On Mon, Oct 15, 2018 at 07:26:12PM +0800, Qiu Wenbo wrote: > Thank you. We can't use the same code path here. The code path of > GApplication on Windows is different compared to Linux. To handle different > file name encodings on Windows, GApplication will get its command line > arguments through g_win32_get_command_line() which will return an arrary of > UTF-8 encoded strings. But on Linux, GApplication simply get its command > line arguments through argv of the program's main() which is in encoded by > current system locale. The only difference between g_option_context_parse() > and g_option_context_parse_strv() is how they interpret their arguments. We > need use g_option_context_parse_strv on Windows since it accept UTF-8 > encoded strings. And we should use the original code path to handle system > locale encoded strings on Linux. Looking at glib's code, on linux, I think we'd be getting locale encoded strings with both methods on linux ( https://gitlab.gnome.org/GNOME/glib/blob/7c1f38b1c9d97519bf087a37a7d8c0a6e6bfdf18/gio/gapplication.c#L2385 and https://gitlab.gnome.org/GNOME/glib/blob/fba8d7a48ad0f4455461162130c7f2eec9c4e363/glib/goption.c#L2688 - strv_mode is only used on Windows to convert between locale encoding and utf8). Christophe
Attachment:
signature.asc
Description: PGP signature
_______________________________________________ virt-tools-list mailing list virt-tools-list@xxxxxxxxxx https://www.redhat.com/mailman/listinfo/virt-tools-list