gh-136216: Updated mentioned RFC in json module#149322
gh-136216: Updated mentioned RFC in json module#149322Viicos wants to merge 1 commit intopython:mainfrom
json module#149322Conversation
| .. [#rfc-errata] As noted in `the errata for RFC 8259 | ||
| <https://www.rfc-editor.org/errata_search.php?rfc=8259>`_, |
There was a problem hiding this comment.
Seems like the errata for RFC 7159 wasn't really solved in 8259, but another errata (with different wording) also exists for RFC 8259.
The footnote is referenced here:
Lines 11 to 16 in 836fbda
Is it really relevant for the Python documentation? Should we remove this sentence entirely?
Documentation build overview
13 files changed ·
|
| The RFC requires that JSON be represented using either UTF-8, UTF-16, or | ||
| UTF-32, with UTF-8 being the recommended default for maximum interoperability. |
There was a problem hiding this comment.
This section is a bit ambiguous, and doesn't really match the last RFC which, as discussed in #136216 (comment), was updated to state:
JSON text exchanged between systems that are not part of a closed ecosystem MUST be encoded using UTF-8.
The documentation sentence is thus outdated, but also doesn't mention that thus us related to exchange between systems (which is out of scope of the json module, again as per #136216 (comment)). I see a couple options:
-
Remove this sentence entirely.
-
Update it with something like:
Suggested changeThe RFC requires that JSON, when exchanged between systems, must be represented using UTF-8. The :mod:`!json` module doesn't handle the string encoding of JSON produced by the :func:`dump` and :func:`dumps` functions. However, for maximum interoperability, :func:`load` and :func:`loads will guess the encoding for :term:`binary file`, :class:`bytes` and :class:`bytearray` inputs.
|
|
||
| Other than the *ensure_ascii* parameter, this module is defined strictly in | ||
| terms of conversion between Python objects and | ||
| :class:`Unicode strings <str>`, and thus does not otherwise directly address |
There was a problem hiding this comment.
I had #136215 opened to remove the Unicode reference. Should I include it here?
Also fixes #84271.
jsonmodule #136216