summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorMartin v. Löwis <martin@v.loewis.de>2003-05-10 07:10:12 (GMT)
committerMartin v. Löwis <martin@v.loewis.de>2003-05-10 07:10:12 (GMT)
commit5467d4c0e31e9db305a4899a44d7978f83e96649 (patch)
treecf52a41492d6c1271a4f32ace0a62237daceb63a /Doc
parentb7b4ce27f74901258f0b3af1fb9483d8f38feab8 (diff)
downloadcpython-5467d4c0e31e9db305a4899a44d7978f83e96649.zip
cpython-5467d4c0e31e9db305a4899a44d7978f83e96649.tar.gz
cpython-5467d4c0e31e9db305a4899a44d7978f83e96649.tar.bz2
Patch #612627: Add encoding attribute to file objects, and determine
the terminal encoding on Windows and Unix.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/api/concrete.tex6
-rw-r--r--Doc/lib/libstdtypes.tex14
2 files changed, 20 insertions, 0 deletions
diff --git a/Doc/api/concrete.tex b/Doc/api/concrete.tex
index f8cbc28..2c14596 100644
--- a/Doc/api/concrete.tex
+++ b/Doc/api/concrete.tex
@@ -2029,6 +2029,12 @@ implementation detail and may change in future releases of Python.
creation.
\end{cfuncdesc}
+\begin{cfuncdesc}{int}{PyFile_Encoding}{PyFileObject *p, char *enc}
+ Set the file's encoding for Unicode output to \var{enc}. Return
+ 1 on success and 0 on failure.
+ \versionadded{2.3}
+\end{cfuncdesc}
+
\begin{cfuncdesc}{int}{PyFile_SoftSpace}{PyObject *p, int newflag}
This function exists for internal use by the interpreter. Sets the
\member{softspace} attribute of \var{p} to \var{newflag} and
diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex
index 04cdbca..951d088 100644
--- a/Doc/lib/libstdtypes.tex
+++ b/Doc/lib/libstdtypes.tex
@@ -1372,6 +1372,20 @@ read-only attribute; the \method{close()} method changes the value.
It may not be available on all file-like objects.
\end{memberdesc}
+\begin{memberdesc}[file]{encoding}
+The encoding that this file uses. When Unicode strings are written
+to a file, they will be converted to byte strings using this encoding.
+In addition, when the file is connected to a terminal, the attribute
+gives the encoding that the terminal is likely to use (that
+information might be incorrect if the user has misconfigured the
+terminal). The attribute is read-only and may not be present on
+all file-like objects. It may also be \code{None}, in which case
+the file uses the system default encoding for converting Unicode
+strings.
+
+\versionadded{2.3}
+\end{memberdesc}
+
\begin{memberdesc}[file]{mode}
The I/O mode for the file. If the file was created using the
\function{open()} built-in function, this will be the value of the