Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reads entire ASCII file without reaching confidence threshold #196

Open
rrthomas opened this issue May 24, 2020 · 0 comments
Open

Reads entire ASCII file without reaching confidence threshold #196

rrthomas opened this issue May 24, 2020 · 0 comments

Comments

@rrthomas
Copy link
Contributor

Investigating a performance bug on large inputs, I found that chardet 3.0.4, using the code under "Example: Detecting encoding incrementally", simply reads the entire file (e.g. I tried with the Complete works of Shakespeare lossily converted to ASCII with recode -f utf-8..ascii).

This is a little surprising, as if I only allow it to read the first bufferful (8KB on my machine), then detector.done is False (as I'd expect), but becomes True after detector.close(). Shouldn't chardet have an inkling this might happen in advance?

I appreciate that it might be complex to fix this issue, so a warning in the section of the docs I mention would be nice, something like: if you're using this on large inputs you might want to limit the maximum amount of data you feed to the incremental detector.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant