@@ -1459,7 +1459,8 @@ are always available. They are listed here in alphabetical order.
14591459 already exists), ``'x' `` for exclusive creation, and ``'a' `` for appending
14601460 (which on *some * Unix systems, means that *all * writes append to the end of
14611461 the file regardless of the current seek position). In text mode, if
1462- *encoding * is not specified the encoding used is platform-dependent:
1462+ *encoding * is not specified, UTF-8 is used by default; if
1463+ :ref: `Python UTF-8 Mode <utf8-mode >` is disabled,
14631464 :func: `locale.getencoding ` is called to get the current locale encoding.
14641465 (For reading and writing raw bytes use binary mode and leave
14651466 *encoding * unspecified.) The available modes are:
@@ -1490,7 +1491,7 @@ are always available. They are listed here in alphabetical order.
14901491 argument) return contents as :class: `bytes ` objects without any decoding. In
14911492 text mode (the default, or when ``'t' `` is included in the *mode * argument),
14921493 the contents of the file are returned as :class: `str `, the bytes having been
1493- first decoded using a platform-dependent encoding or using the specified
1494+ first decoded using the default encoding or using the specified
14941495 *encoding * if given.
14951496
14961497 .. note ::
@@ -1519,9 +1520,11 @@ are always available. They are listed here in alphabetical order.
15191520 described above for binary files.
15201521
15211522 *encoding * is the name of the encoding used to decode or encode the file.
1522- This should only be used in text mode. The default encoding is platform
1523- dependent (whatever :func: `locale.getencoding ` returns), but any
1524- :term: `text encoding ` supported by Python can be used.
1523+ This should only be used in text mode. The default encoding is UTF-8;
1524+ if :ref: `Python UTF-8 Mode <utf8-mode >` is disabled, the default is
1525+ platform-dependent (whatever :func: `locale.getencoding ` returns).
1526+ Any :term: `text encoding ` supported by Python can be used, and
1527+ ``encoding="locale" `` specifies the current locale encoding explicitly.
15251528 See the :mod: `codecs ` module for the list of supported encodings.
15261529
15271530 *errors * is an optional string that specifies how encoding and decoding
@@ -1638,6 +1641,10 @@ are always available. They are listed here in alphabetical order.
16381641 .. versionchanged :: 3.11
16391642 The ``'U' `` mode has been removed.
16401643
1644+ .. versionchanged :: 3.15
1645+ UTF-8 is now the default encoding, instead of the
1646+ platform-dependent locale encoding (:pep: `686 `).
1647+
16411648.. function :: ord(character, /)
16421649
16431650 Return the ordinal value of a character.
0 commit comments