CharacterSet

extension CharacterSet
  • Creates a CharacterSet from RFC 3986 allowed characters.

    RFC 3986 states that the following characters are “reserved” characters.

    • General Delimiters: “:”, “#”, “[”, “]”, “@”, “?”, “/”
    • Sub-Delimiters: “!”, “$”, “&”, “‘”, “(”, “)”, “*”, “+”, “,”, “;”, “=”

    In RFC 3986 - Section 3.4, it states that the “?” and “/” characters should not be escaped to allow query strings to include a URL. Therefore, all “reserved” characters with the exception of “?” and “/” should be percent-escaped in the query string.

    Declaration

    Swift

    public static let afURLQueryAllowed: CharacterSet