Changed the code for URLencoding
Included boundary conditions checking
Added unit test cases