views:

63

answers:

1
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.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?

Many thanks!

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

A: 

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

Snazzer
Is there any URL encoding APIs?Need I write it myself? Many thanks!
sdtom