Closed
Description
I did this
#include <string>
#include <regex>
#include <tuple>
#include <iostream>
#include <curl/curl.h>
int main() {
std::string input = "http://resum%c3%a9.com";
CURLUcode rc = CURLUE_BAD_HANDLE;
CURLU *urlh = curl_url();
std::cout << "libcurl version" << curl_version() << std::endl;
rc = curl_url_set(urlh, CURLUPART_URL, input.c_str(), 0);
if(rc != CURLUE_OK)
{
std::cout << "curlucode = " << rc << std::endl;
curl_url_cleanup(urlh);
}
char *host;
rc = curl_url_get(urlh, CURLUPART_HOST, &host, 0);
if (rc != CURLUE_OK)
{
std::cout << "curlucode = " << rc << std::endl;
curl_url_cleanup(urlh);
}
std::cout << host << std::endl;
free(host);
curl_url_cleanup(urlh);
return 0;
}
I expected the following
libcurl versionlibcurl/8.10.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libpsl/0.21.0
resum%c3%a9.com
but the actual output was
libcurl versionlibcurl/8.10.0 OpenSSL/1.1.1f zlib/1.2.11 brotli/1.0.7 libpsl/0.21.0
resumé.com
curl/libcurl version
libcurl/8.10.0
operating system
Ubuntu 20.04