UrlDecode
From CometWiki
(Difference between revisions)
Revision as of 19:16, 3 June 2016
Changes characters which were encoded by the browser to their ascii equivalents...
void URLdecode(CString &Value) { Value.Replace(_T("""),_T("\"")); Value.Replace(_T("<" ),_T("<")); Value.Replace(_T(">" ),_T(">")); Value.Replace(_T("&" ),_T("&")); Value.Replace(_T(" "),_T(" ")); Value.Replace(_T("+"),_T(" ")); CString a; CString b; for (int i=0;i<=255;i++) { char x = i; CString b = x; a.Format("&#%d;",i); Value.Replace(a,b); a.Format("%%%02X",i); Value.Replace(a,b); a.Format("%%%02x",i); Value.Replace(a,b); } }