diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-13 20:09:14 (GMT) |
---|---|---|
committer | Serhiy Storchaka <storchaka@gmail.com> | 2013-10-13 20:09:14 (GMT) |
commit | bfdcd436f0410e2b3eb34ce4fd7411488d3f13fb (patch) | |
tree | 92e02b473c00b7dc9cbe908681723079a3466c7f /Doc/howto/unicode.rst | |
parent | 24201d497cf23d399cceadad8058261c13ae536f (diff) | |
download | cpython-bfdcd436f0410e2b3eb34ce4fd7411488d3f13fb.zip cpython-bfdcd436f0410e2b3eb34ce4fd7411488d3f13fb.tar.gz cpython-bfdcd436f0410e2b3eb34ce4fd7411488d3f13fb.tar.bz2 |
Issue #18758: Fixed and improved cross-references.
Diffstat (limited to 'Doc/howto/unicode.rst')
-rw-r--r-- | Doc/howto/unicode.rst | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/Doc/howto/unicode.rst b/Doc/howto/unicode.rst index 486195a..4fc8c5c 100644 --- a/Doc/howto/unicode.rst +++ b/Doc/howto/unicode.rst @@ -531,9 +531,10 @@ The solution would be to use the low-level decoding interface to catch the case of partial coding sequences. The work of implementing this has already been done for you: the built-in :func:`open` function can return a file-like object that assumes the file's contents are in a specified encoding and accepts Unicode -parameters for methods such as :meth:`read` and :meth:`write`. This works through -:func:`open`\'s *encoding* and *errors* parameters which are interpreted just -like those in :meth:`str.encode` and :meth:`bytes.decode`. +parameters for methods such as :meth:`~io.TextIOBase.read` and +:meth:`~io.TextIOBase.write`. This works through:func:`open`\'s *encoding* and +*errors* parameters which are interpreted just like those in :meth:`str.encode` +and :meth:`bytes.decode`. Reading Unicode from a file is therefore simple:: @@ -656,7 +657,8 @@ encodings, taking a stream that returns data in encoding #1 and behaving like a stream returning data in encoding #2. For example, if you have an input file *f* that's in Latin-1, you -can wrap it with a :class:`StreamRecoder` to return bytes encoded in UTF-8:: +can wrap it with a :class:`~codecs.StreamRecoder` to return bytes encoded in +UTF-8:: new_f = codecs.StreamRecoder(f, # en/decoder: used by read() to encode its results and |