urlEncode

From https://datatracker.ietf.org/doc/html/rfc3986#autoid-12:

    When a new URI scheme defines a component that represents textual
    data consisting of characters from the Universal Character Set [UCS],
    the data should first be encoded as octets according to the UTF-8
    character encoding [STD63]; then only those octets that do not
    correspond to characters in the unreserved set should be percent-
    encoded.  For example, the character A would be represented as "A",
    the character LATIN CAPITAL LETTER A WITH GRAVE would be represented
    as "%C3%80", and the character KATAKANA LETTER A would be represented
    as "%E3%82%A2".

If I'm reading that right, data must be first encoded to UTF8 then percent-encoded as needed.

This is especially important for older iOS versions where NSURL(String) returns null (and crashes with a NullPointerException) if invalid characters are encountered

Somewhere in 2023-2024, NSURL will begin percent-encoding those characters: https://developer.apple.com/documentation/foundation/nsurl