# HG changeset patch # User Frank van Dijk # Date 1407059116 -7200 # Sun Aug 03 11:45:16 2014 +0200 # Node ID 821f9223595c347567aac68f68f20a6f9276290c # Parent 751328f413a874895e662f0608378c647ac628b7 steer folks away from using codecs.open because it handles text files incorrectly diff -r 751328f413a8 -r 821f9223595c Doc/library/codecs.rst --- a/Doc/library/codecs.rst Sat Aug 02 22:32:33 2014 -0700 +++ b/Doc/library/codecs.rst Sun Aug 03 11:45:16 2014 +0200 @@ -244,15 +244,15 @@ .. note:: - The wrapped version's methods will accept and return strings only. Bytes - arguments will be rejected. + Files are always opened in binary mode, even if no binary mode was + specified. This means that no automatic conversion of ``b'\n'`` is done + on reading and writing. To open text files with automatic + newline conversion use the built-in :func:`open` function instead. .. note:: - Files are always opened in binary mode, even if no binary mode was - specified. This is done to avoid data loss due to encodings using 8-bit - values. This means that no automatic conversion of ``b'\n'`` is done - on reading and writing. + The wrapped version's methods will accept and return strings only. Bytes + arguments will be rejected. *encoding* specifies the encoding which is to be used for the file.