开发者

CAtlNavigateData can not deal with special symbol such as +

开发者 https://www.devze.com 2022-12-10 17:06 出处:网络
CAtlNavigateData navData; CStringA m_strForm = \"name=+++&priv=1&password=\"; navData.SetSocketTimeout(m_nMilliSecond);
CAtlNavigateData navData;
CStringA m_strForm = "name=+++&priv=1&password=";
navData.SetSocketTimeout(m_nMilliSecond);
navData.SetMethod(ATL_HTTP_METHOD_POST); 
navData.SetPostData((BYTE*)(LPSTR)(LPCSTR)m_strForm, m_strForm.开发者_Go百科GetLength(), QHTTP_FORM_URLENCODE); 

I catch the posted package, and find post data name = "", it should be name="+++". Does SetPostData(...) can not deal with special symbol. How can I avoid this?

Thanks for Snazzer's answer. Does ATL provides API for doing this?


You need to URL encode your string, so replace the '+' with '%2B'

CStringA m_strForm = "name=%2B%2B%2B&priv=1&password=";

For more information, check out URL encoding

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号