Skip to content

Instantly share code, notes, and snippets.

@markvanwijnen
Last active March 8, 2021 15:21
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save markvanwijnen/8a8a240d2ec753373969b2bb462b4aa9 to your computer and use it in GitHub Desktop.
Save markvanwijnen/8a8a240d2ec753373969b2bb462b4aa9 to your computer and use it in GitHub Desktop.
extension CharacterSet {
static var urlRFC3986Allowed: CharacterSet {
CharacterSet(charactersIn: "-_.~").union(.alphanumerics)
}
}
extension String {
var oAuthURLEncodedString: String {
self.addingPercentEncoding(withAllowedCharacters: .urlRFC3986Allowed) ?? self
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment