当前位置:编程学习 > C#/ASP.NET >>

libcurl怎么使用中文参数和接收中文数据

VC中我使用了libcurl类库做HTTP请求,但使用下面的方法发送GET请求,WEB服务器接收到的是乱码
curl_easy_setopt(curl, CURLOPT_URL, "http://localhost:1300/Test/GetTest?test=测试");

是不是需要编码一下?

另外使用

static size_t write_memory(char *data, size_t size, size_t nmemb, string *write_data)
{
//size = size * 2;
unsigned long sizes = size * nmemb;
if (write_data == NULL) return 0;
write_data->append(data, sizes);
return sizes;
}
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, write_memory);

返回的数据中有中文的话,好像也是乱码,需要怎么设置下? --------------------编程问答-------------------- 请教各位高手
补充:.NET技术 ,  VC.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,