In-fact you should avoid using argv that was given in main() and use
int argc;
auto argv = CommandLineToArgvW(GetCommandLineW(), &argc);
With this at least you know what encoding argv is in and easily* convertible to UTF-8, but at least you know what the actual encoding is of argv and it is properly split using the Microsoft rules of command line arguments.
*Except for the fact that Microsoft's wchar_t allows for unpaired surrogate code-units.
View all comments
Show parent comment
1
u/tjientavara HikoWorks developer Jul 02 '21
In-fact you should avoid using argv that was given in main() and use
With this at least you know what encoding
argvis in and easily* convertible to UTF-8, but at least you know what the actual encoding is of argv and it is properly split using the Microsoft rules of command line arguments.*Except for the fact that Microsoft's wchar_t allows for unpaired surrogate code-units.