Optimize Connection::encode

I think the regex would be faster, I didn't do it because replacing the Java function with this non-optimized native was enough to remove |encode| from the profile (from 40 ms to 2 ms). I'll implement it with a regex.

 * All characters except for the following are escaped (converted into their 
 * hexadecimal value prepended by '%'):
 *     letters ('a'..'z', 'A'..'Z'),
 *     numbers ('0'..'9'),
 *     unreserved characters ('-', '_', '.', '!', '~', '*', '\'', '(', ')'), and
 *     reserved characters ('/', ':')