Simple find and replace within the standard javascript library.
Below example is used to encode the url string before an AJAX connection.
input = input.replace(/#/g,"%23"); input = input.replace(/\//g,"%2F");