mirror of
https://github.com/Kitware/CMake.git
synced 2026-02-14 02:59:53 -06:00
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.
This commit is contained in:
@@ -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<char> 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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user