Stream: helpdesk (published)

Topic: Format url


view this post on Zulip Yakir Luc Gagnon (Jan 03 2022 at 09:40):

Is there an existing package/function for formatting a string into a valid url?
For instance, replacing spaces with %20:

julia> str = "https://julialang.zulipchat.com/word1 word2.com"
"https://julialang.zulipchat.com/word1 word2.com"

julia> url = replace(str, " " => "%20")
"https://julialang.zulipchat.com/word1%20word2.com"

view this post on Zulip Andrey Oskin (Jan 03 2022 at 10:42):

HTTP.jl has this functionality in it's URI module

view this post on Zulip Andrey Oskin (Jan 03 2022 at 10:43):

https://juliaweb.github.io/HTTP.jl/stable/public_interface/#URIs.escapeuri

view this post on Zulip Sundar R (Jan 03 2022 at 22:07):

URIs.jl is a package by itself, and HTTP.jl re-exports that functionality from it. So you can directly add URIs if you don't need other functionality from HTTP.jl.


Last updated: Oct 02 2023 at 04:34 UTC