From 6fe7acfe1d87228683e2f65a6d9f27299486cd02 Mon Sep 17 00:00:00 2001 From: Brad King Date: Mon, 9 Feb 2026 09:32:12 -0500 Subject: [PATCH] curl: Build with support for wide-character filesystem APIs on Windows Curl 7.71 added an option to open files on Windows using wide APIs. See curl commit `ffdddb45d9` (curl_setup: support Unicode functions to open files on Windows, 2020-01-02, `curl-7_71_0~148`). When enabled, curl's own narrow APIs expect UTF-8 because that is what their command-line tool uses internally. See curl commit `9e5669f388` (tool: support UTF-16 command line on Windows, 2019-04-12, `curl-7_71_0~149`). Revert our previous workaround from commit e63dcb1378 (Encoding: Use encoding libcurl expects with file: urls, 2014-11-05, v3.2.0-rc1~420^2) in favor of passing URLs to curl encoded as UTF-8. --- Source/cmCurl.cxx | 18 ------------------ Utilities/cmcurl/CMakeLists.txt | 2 +- 2 files changed, 1 insertion(+), 19 deletions(-) diff --git a/Source/cmCurl.cxx b/Source/cmCurl.cxx index 484ac1fc97..7dc6b7cf1b 100644 --- a/Source/cmCurl.cxx +++ b/Source/cmCurl.cxx @@ -238,24 +238,6 @@ std::string cmCurlFixFileURL(std::string url) // Explicitly encode spaces for a URL. cmSystemTools::ReplaceString(url, " ", "%20"); -#if defined(_WIN32) - // libcurl doesn't support file:// urls for unicode filenames on Windows. - // Convert string from UTF-8 to ACP if this is a file:// URL. - std::wstring wurl = cmsys::Encoding::ToWide(url); - if (!wurl.empty()) { - int mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, nullptr, 0, - nullptr, nullptr); - if (mblen > 0) { - std::vector chars(mblen); - mblen = WideCharToMultiByte(CP_ACP, 0, wurl.c_str(), -1, &chars[0], - mblen, nullptr, nullptr); - if (mblen > 0) { - url = &chars[0]; - } - } - } -#endif - return url; } diff --git a/Utilities/cmcurl/CMakeLists.txt b/Utilities/cmcurl/CMakeLists.txt index 0b4b558716..2c6a6e6a19 100644 --- a/Utilities/cmcurl/CMakeLists.txt +++ b/Utilities/cmcurl/CMakeLists.txt @@ -82,7 +82,7 @@ set(ENABLE_CURLDEBUG OFF CACHE INTERNAL "No curl TrackMemory features") set(ENABLE_DEBUG OFF CACHE INTERNAL "No curl debug features") set(ENABLE_IPV6 ON CACHE INTERNAL "Enable curl IPv6 support detection") set(ENABLE_THREADED_RESOLVER OFF CACHE INTERNAL "No curl POSIX threaded DNS lookup") -set(ENABLE_UNICODE OFF) +set(ENABLE_UNICODE ON) set(ENABLE_UNIX_SOCKETS OFF CACHE INTERNAL "No curl Unix domain sockets support") set(HAVE_ATOMIC 0) set(HAVE_BORINGSSL 0) # we do not need this info