Elm 0.19 moved encodeUri and decodeUri to the elm/url package,
and renamed them percentEncode and percentDecode.
Use this to unescape query parameters. It converts things like %2F to
/. It can fail in some cases. For example, there is no way to unescape %
because it could never appear alone in a properly escaped string.
It works just like decodeURIComponent in JavaScript.
-- ASCII
decodeUri "hat" --> Just "hat"
decodeUri "to%20be" --> Just "to be"
decodeUri "99%25" --> Just "99%"
-- UTF-8
decodeUri "%24" --> Just "$"
decodeUri "%C2%A2" --> Just "¢"
decodeUri "%E2%82%AC" --> Just "€"
-- Failing
decodeUri "%" --> Nothing -- not followed by two hex digits
decodeUri "%XY" --> Nothing -- not followed by two HEX digits
decodeUri "%C2" --> Nothing -- half of the "¢" encoding "%C2%A2"
Use this to escape query parameters. Converts characters like
/to%2Fso that it does not clash with normal URLIt work just like
encodeURIComponentin JavaScript.