URI encode and decode special characters in username and password fields

I was having problems with passwords which contained special characters (in my case a %-sign). This change handles these special characters properly. Implementation can be better, but this seemed sufficient.