You can override your own function to add this functionality.
Here is an example of the encodeURIComponent
extension to handle exclamation points.
You can also add a new function if you want the code to be shorter.
This is for you, however.
Additional examples of this can be found on the Mozilla Developer Website
source share