1. This will URL-encode every single character in the string. While this works, it's not necessarily what you want. You could skip alphanumeric characters (print them as-is rather than printing their hex codes) to make the output look cleaner.
2. I think the hex codes are always supposed to be 2 digits long in URL encoding. Your code will backfire with ASCII codes less than 16, I think. Use the format specification "%02x" (that's a zero) to pad 1-character codes with a zero.
3. I'm pretty sure instead of this: y= ("%x",a[i]);
you meant this: y = a[i];
Comment