可以使用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());