addressable
addressable copied to clipboard
`normalized_encode` incorrectly unencodes `%26` to `&`
When a query parameter includes %26, normalized_encode replaces it with a literal &, which results in a different URI:
pry(main)> Addressable::URI.normalized_encode("https://example.com?foo=bar%26baz")
=> "https://example.com?foo=bar&baz"
The more comprehensive URI#normalize method works correctly:
pry(main)> Addressable::URI.parse("https://example.com?foo=bar%26baz").normalize.to_s
=> "https://example.com/?foo=bar%26baz"
This issue is possibly related to #366 and #386. However, both of those issues apply to URI#normalize, wheras this %26 issue only seems to apply to the normalized_encode method.
I think this issue is the same as https://github.com/sporkmonger/addressable/issues/366 but I'll keep this one open until it has been addressed.