UrlDecode

From CometWiki

(Difference between revisions)
Jump to: navigation, search
(initial page)
(initial page)
Line 1: Line 1:
Changes characters which were encoded by the browser to their ascii equivalents...
Changes characters which were encoded by the browser to their ascii equivalents...
-
 
+
<pre>
void URLdecode(CString &Value)
void URLdecode(CString &Value)
{
{
Line 23: Line 23:
}
}
}
}
 +
</pre>

Revision as of 19:23, 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);
	}
}
Personal tools