Skip to content

Commit d01defb

Browse files
committed
gh-125188: Improve explanation of errors argument in urllib.parse
1 parent 82c62ab commit d01defb

1 file changed

Lines changed: 8 additions & 4 deletions

File tree

‎Doc/library/urllib.parse.rst‎

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,8 @@ or on combining URL components into a URL string.
247247

248248
The optional *encoding* and *errors* parameters specify how to decode
249249
percent-encoded sequences into Unicode characters, as accepted by the
250-
:meth:`bytes.decode` method.
250+
:meth:`bytes.decode` method. See :func:`quote` for more about the
251+
*encoding* and *errors* arguments.
251252

252253
The optional argument *max_num_fields* is the maximum number of fields to
253254
read. If set, then throws a :exc:`ValueError` if there are more than
@@ -296,7 +297,8 @@ or on combining URL components into a URL string.
296297

297298
The optional *encoding* and *errors* parameters specify how to decode
298299
percent-encoded sequences into Unicode characters, as accepted by the
299-
:meth:`bytes.decode` method.
300+
:meth:`bytes.decode` method. See :func:`quote` for more about the
301+
*encoding* and *errors* arguments.
300302

301303
The optional argument *max_num_fields* is the maximum number of fields to
302304
read. If set, then throws a :exc:`ValueError` if there are more than
@@ -652,7 +654,8 @@ task isn't already covered by the URL parsing functions above.
652654
Although these parameters default to ``None`` in the function signature,
653655
when processing :class:`str` inputs, *encoding* effectively defaults to ``'utf-8'``
654656
and *errors* to ``'strict'``, meaning unsupported characters raise a
655-
:class:`UnicodeEncodeError`.
657+
:class:`UnicodeEncodeError`. See :ref:`standard-encodings` and
658+
:ref:`error-handlers` for the values that *encoding* and *errors* can take.
656659
*encoding* and *errors* must not be supplied if *string* is a
657660
:class:`bytes`, or a :class:`TypeError` is raised.
658661

@@ -692,7 +695,8 @@ task isn't already covered by the URL parsing functions above.
692695

693696
*encoding* defaults to ``'utf-8'``.
694697
*errors* defaults to ``'replace'``, meaning invalid sequences are replaced
695-
by a placeholder character.
698+
by a placeholder character. See :func:`quote` for more about the
699+
*encoding* and *errors* arguments.
696700

697701
Example: ``unquote('/El%20Ni%C3%B1o/')`` yields ``'/El Niño/'``.
698702

0 commit comments

Comments
 (0)