bpo-17110: doc: add note how to get bytes from sys.argv (GH-12602) · python/cpython@5b80cb5 (original) (raw)

Original file line number Diff line number Diff line change
@@ -30,6 +30,12 @@ always available.
30 30 To loop over the standard input, or the list of files given on the
31 31 command line, see the :mod:`fileinput` module.
32 32
33 + .. note::
34 + On Unix, command line arguments are passed by bytes from OS. Python decodes
35 + them with filesystem encoding and "surrogateescape" error handler.
36 + When you need original bytes, you can get it by
37 + ``[os.fsencode(arg) for arg in sys.argv]``.
38 +
33 39
34 40 .. data:: base_exec_prefix
35 41