urlstd.parse.utf8_percent_encode#

urlstd.parse.utf8_percent_encode(s: str, safe: str, space_as_plus: bool = False) str#

Returns a percent-encoded string after encoding with utf-8.

Invalid surrogates will be replaced with U+FFFD. Also, if the encoding fails, it will be replaced with the appropriate XML character reference.

This is equivalent to string_percent_encode(s, safe, encoding='utf-8', space_as_plus=space_as_plus).

Parameters:
  • s – A string to percent-encode.

  • safe – ASCII characters that should not be percent-encoded.

  • space_as_plus – If True, replace 0x20 (space) with U+002B (plus sign).

Returns:

A percent-encoded string after encoding with utf-8.