Movatterモバイル変換


[0]ホーム

URL:


homepage

Message306701

This issue trackerhas been migrated toGitHub, and is currentlyread-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Authorserhiy.storchaka
Recipientsserhiy.storchaka
Date2017-11-22.07:40:16
SpamBayes Score-1.0
Marked as misclassifiedYes
Message-id<1511336416.94.0.213398074469.issue32110@psf.upfronthosting.co.za>
In-reply-to
Content
Usually the read() method of a file-like object takes one optional argument which limits the amount of data (the number of bytes or characters) returned if specified.codecs.StreamReader.read() also has such parameter. But this is the second parameter. The first parameter limits the number of bytes read for decoding. read(1) can return 70 characters, that will confuse most callers which expect either a single character or an empty string (at the end of stream).Some times ago codecs.open() was recommended as a replacement for the builtin open() in programs that should work in 2.x and 3.x (this was before adding io.open()), and it is still used in many programs. But this peculiarity makes it bad replacement of builtin open().I wanted to fix this issue long time ago, but forgot, and the question on Stack Overflow has reminded me about this.https://stackoverflow.com/questions/46437761/codecs-openutf-8-fails-to-read-plain-ascii-file
History
DateUserActionArgs
2017-11-22 07:40:16serhiy.storchakasetrecipients: +serhiy.storchaka
2017-11-22 07:40:16serhiy.storchakasetmessageid: <1511336416.94.0.213398074469.issue32110@psf.upfronthosting.co.za>
2017-11-22 07:40:16serhiy.storchakalinkissue32110 messages
2017-11-22 07:40:16serhiy.storchakacreate
Supported byThe Python Software Foundation,
Powered byRoundup
Copyright © 1990-2022,Python Software Foundation
Legal Statements

[8]ページ先頭

©2009-2026 Movatter.jp