views:

332

answers:

2

I am using the following code:

CAtlNavigateData navData;
CStringA m_strForm = "name=+++&priv=1&password=";
navData.SetPostData((BYTE*)(LPSTR)(LPCSTR)m_strForm, m_strForm.GetLength(), QHTTP_FORM_URLENCODE);

special symbols such as :"+++" need to do url-encoding, without url-encoding, +++ will turned into space.

I need a converer.

CString URLEncodingConvertion(const CString& original)
{
XXX
}

Is there any APIs for doing this in c++? If I implement it myself, maybe I can not take whole situations into account. And can not control the code.

Can anyone help?

Many thanks!

+1  A: 

AtlEscapeUrl()

Georg Fritzsche
A: 

This question looks like a duplicate. The other question uses a different function to do url escaping.

Snazzer
Yes, one from WinInet because the linked question did not include ATL as a possibility.
Georg Fritzsche