解决curl请求字段中带中文出错的问题

可以使用curl_escape方法解决,官方文档: http://curl.haxx.se/libcurl/c/curl_escape.html

char* escape_control = curl_escape(describe.c_str(), describe.size());   //std::string describe中为中文或带了空格
describe = escape_control;
curl_free(escape_control);   //释放

std::
string strUrl= "http://192.168.16:8080/login?describe=" + describe; curl_easy_setopt(pCurl, CURLOPT_URL, strUrl.c_str());
原文地址:https://www.cnblogs.com/tingtaishou/p/14735237.html