Updated: JS and URI escape routines.

Based upon feedback from Ryan, Dav and other I have updated the escaping routines to be more generic. Have almost avoided the character blacklist approach.