Since 8ff3fff introduced the addressable gem as a runtime dependency, it's now possible to replace all custom URI encoding logic with addressable's methods.
It does handle some characters differently - e.g. it now doesn't escape URLs in URI fragments (see the added test). Previous escaping behavior was reported as an issue in Discourse.