Search results

encodeURI :: String -> Maybe String
P purescript-js-uri M JSURI
encodeUri :: String -> String
P purescript-payload M Payload.Client.Internal.EncodeUri
encodeURIComponent :: String -> Maybe String

URI-encode a string according to RFC3896. Implemented using JavaScript's encodeURIComponent.

> encodeURIComponent "https://purescript.org"
Just "https%3A%2F%2Fpurescript.org"

Encoding a URI can fail with a URIError if the string contains malformed characters. If you are confident you are encoding a well-formed string then you can run this function unsafely:

import Partial.Unsafe (unsafePartial)
import Data.Maybe (fromJust)

unsafeEncode :: String -> String
unsafeEncode str = unsafePartial $ fromJust $ encodeURIComponent str
P purescript-js-uri M JSURI
encodeURIComponent :: String -> String
P purescript-httpure M HTTPure.Utils
encodeURIComponent :: String -> String
P purescript-httpurple M HTTPurple.Utils

No further results.