mirror of
https://github.com/curl/curl.git
synced 2026-08-24 19:03:40 +03:00
tool: support UTF-16 command line on Windows
- use `wmain` instead of `main` when `_UNICODE` is defined [0] - define `argv_item_t` as `wchar_t *` in this case - use the curl_multibyte gear to convert the command-line arguments to UTF-8 This makes it possible to pass parameters with characters outside of the current locale on Windows, which is required for some tests, e.g. the IDN tests. Out of the box, this currently only works with the Visual Studio project files, which default to Unicode, and winbuild with the `ENABLE_UNICODE` option. [0] https://devblogs.microsoft.com/oldnewthing/?p=40643 Ref: https://github.com/curl/curl/issues/3747 Closes https://github.com/curl/curl/pull/3784
This commit is contained in:
parent
a55c835e6b
commit
9e5669f388
4 changed files with 25 additions and 11 deletions
|
|
@ -273,22 +273,28 @@ static void restore_terminal(void)
|
|||
/*
|
||||
** curl tool main function.
|
||||
*/
|
||||
#ifdef _UNICODE
|
||||
int wmain(int argc, wchar_t *argv[])
|
||||
#else
|
||||
int main(int argc, char *argv[])
|
||||
#endif
|
||||
{
|
||||
CURLcode result = CURLE_OK;
|
||||
struct GlobalConfig global;
|
||||
memset(&global, 0, sizeof(global));
|
||||
|
||||
#ifdef WIN32
|
||||
#ifdef _tcscmp
|
||||
/* Undocumented diagnostic option to list the full paths of all loaded
|
||||
modules. This is purposely pre-init. */
|
||||
if(argc == 2 && !strcmp(argv[1], "--dump-module-paths")) {
|
||||
if(argc == 2 && !_tcscmp(argv[1], _T("--dump-module-paths"))) {
|
||||
struct curl_slist *item, *head = GetLoadedModulePaths();
|
||||
for(item = head; item; item = item->next)
|
||||
printf("%s\n", item->data);
|
||||
curl_slist_free_all(head);
|
||||
return head ? 0 : 1;
|
||||
}
|
||||
#endif /* _tcscmp */
|
||||
/* win32_init must be called before other init routines. */
|
||||
result = win32_init();
|
||||
if(result) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue