kinetex - v1.0.0-rc.1
    Preparing search index...

    Function percentEncode

    • Percent-encode a string per RFC 3986. By default encodes everything except unreserved chars (A-Z a-z 0-9 - _ . ~). Pass allowReserved: true to also let reserved characters through.

      Surrogate pairs (code points > 0xFFFF like emoji 😀, 𝄞, etc.) are encoded as their UTF-8 byte sequence. For example, U+1F600 (😀) becomes %F0%9F%90%80. This is correct per RFC 3986 which uses UTF-8 as the default encoding.

      Parameters

      • str: string

        The string to percent-encode.

      • allowReserved: boolean = false

        If true, reserved characters (:/?#[]@!$&'()*+,;=) pass through.

      Returns string

      The percent-encoded string.