If your talking about the urls stored in your hubspot database of contacts/companies then I think you should be able to do this more easily using the “Insycle Data Management” app add-on for Hubspot:
The %20 is added anytime you have a space in your URL, if you don’t want them, you would need to make sure that you don’t have spaces included when generating the URL.