Since such URLs very often come from copy & paste another way to deal with this is smart auto-quoting when a paste is detected via the "bracketed paste" feature of modern terminal emulators. zsh does this if you enable url-quote-magic.
(I'm a fish developer)