yo,
Good job on this. You should, hoever, encode the incoming data to avoid any issues (for example, using the ampersand (&) could cause havoc.).
I made this function for you:
pawn Код:
stock EncodeURL( szString[ ], iSize = sizeof( szString ) )
{
for ( new i = 0, l = strlen( szString ); i < l; i++ )
{
switch ( szString[ i ] )
{
case '!', '(', ')', '\'', '*',
'0' .. '9',
'A' .. 'Z',
'a' .. 'z':
{
continue;
}
case ' ':
{
szString[ i ] = '+';
continue;
}
}
new
s_szHex[ 8 ]
;
if ( i + 3 >= iSize )
{
szString[ i ] = EOS;
break;
}
if ( l + 3 >= iSize )
szString[ iSize - 3 ] = EOS;
format( s_szHex, sizeof( s_szHex ), "%02h", szString[ i ] );
szString[ i ] = '%';
strins( szString, s_szHex, i + 1, iSize );
l += 2;
i += 2;
if ( l > iSize - 1 )
l = iSize - 1;
}
}
Simply run any incoming strings through that. Make sure you have enough space in the array, though.