Code Crash!!!
-
Hi, I've written a code which replaces characters in a string with their respective URLEncode (i.e a " " will be replaced by "+" etc..). However the code crashes at execution. Please help!! Here's the code extract; Code: >----------------------------------------------------------------------------- for(j=0;j
-
Hi, I've written a code which replaces characters in a string with their respective URLEncode (i.e a " " will be replaced by "+" etc..). However the code crashes at execution. Please help!! Here's the code extract; Code: >----------------------------------------------------------------------------- for(j=0;j
Hmmm When you post code here, you must use > for > and < for < else your post will get partially swallowed by the browser's html rendering engine. Nish
Author of the romantic comedy Summer Love and Some more Cricket [New Win] Review by Shog9 Click here for review[NW]
-
Hi, I've written a code which replaces characters in a string with their respective URLEncode (i.e a " " will be replaced by "+" etc..). However the code crashes at execution. Please help!! Here's the code extract; Code: >----------------------------------------------------------------------------- for(j=0;j
for(j=0;j<one.length();j++)
{
indxD = one.find_first_of ( " " , 0 );
one.replace(indxD,1,"%2B",3);
}From the problem I see, you should escape % and replace it to %%2B, while the length is still 3. (Escaping escape code, weird that!).
She's so dirty, she threw a boomerang and it wouldn't even come back.
-
for(j=0;j<one.length();j++)
{
indxD = one.find_first_of ( " " , 0 );
one.replace(indxD,1,"%2B",3);
}From the problem I see, you should escape % and replace it to %%2B, while the length is still 3. (Escaping escape code, weird that!).
She's so dirty, she threw a boomerang and it wouldn't even come back.
In addition, your encode routine is completely wrong. Spaces should be replaced with +, while non alphabetical characters should be replaced with their hex ascii representation prefixed with a %. That's not exactly what you are doing. It's also questionable because whether you are using javascript (escapeurl), ASP (urlencode), C++ (InternetCanonicalizeUrl, UrlEscape), .NET (HttpUtility.UrlEncode), you've many SAFE ways to do it already. Why reinvent that fucking squared wheel ?:wtf:
She's so dirty, she threw a boomerang and it wouldn't even come back.