For example you might want to do this:
Code: Select all
GET /some/script.php?parameter=Hello world!!!~Code: Select all
GET /some/script.php?parameter=HelloHere's a stock that makes this work for you
Code: Select all
new const sHexTable[] = "0123456789abcdef"
stock urlencode(const sString[], sResult[], len)
{
new from, c
new to
while(from < len)
{
c = sString[from++]
if(c == 0)
{
sResult[to++] = c
break
}
else if(c == ' ')
{
sResult[to++] = '+'
}
else if((c < '0' && c != '-' && c != '.') ||
(c < 'A' && c > '9') ||
(c > 'Z' && c < 'a' && c != '_') ||
(c > 'z'))
{
if((to + 3) > len)
{
sResult[to] = 0
break
}
sResult[to++] = '%'
sResult[to++] = sHexTable[c >> 4]
sResult[to++] = sHexTable[c & 15]
}
else
{
sResult[to++] = c
}
}
} Code: Select all
public somefunc()
{
new source[64] = "Hello ~ world!"
new output[128]
urlencode(source, output, charsmax(output)
server_print("original= %s", output)
server_print("encoded= %s", source)
} Code: Select all
original= Hello ~ world!
encoded= Hello+%7e+world!I copied the function from php source code.Nice, yesterday I was having problem with System.Web.Server.URLEncode and I create my func.
But your func work better than my. I will update![]()
You have urlencode function in php.
I have Http Solution also in .NET.
Yep, I see that function in a PHP Forum.
