Created
January 4, 2023 04:03
-
-
Save DavidMetcalfe/09ad4a7a5bf1b6be37dfd10d9353cdd8 to your computer and use it in GitHub Desktop.
Escape and unescape URLs in PowerShell
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function EscapeURL() { | |
# Escape the given URL and return it. | |
param ( | |
[Parameter()] | |
[string] $URL_To_Escape | |
) | |
return [uri]::EscapeDataString($URL_To_Escape) | |
} | |
function UnescapeURL() { | |
# Unescape the given URL and return it. | |
param ( | |
[Parameter()] | |
[string] $URL_To_Unescape | |
) | |
return [uri]::UnescapeDataString($URL_To_Unescape) | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment