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

Wrong charset detect! #219

Open
NB-Dragon opened this issue Apr 13, 2021 · 3 comments
Open

Wrong charset detect! #219

NB-Dragon opened this issue Apr 13, 2021 · 3 comments

Comments

@NB-Dragon
Copy link

Reproduce

>>> chardet.detect_all("中".encode("gb2312"))
[{'encoding': 'ISO-8859-5', 'confidence': 0.99, 'language': 'Russian'}, {'encoding': 'ISO-8859-1', 'confidence': 0.365, 'language': ''}]

Environment

Python 3.7.2
chardet 4.0.0

@NB-Dragon
Copy link
Author

谷歌浏览器可以正常识别gb2312的编码,不知道为何。

$filename = mb_convert_encoding("中", "gb2312");
header("content-disposition:attachment; filename=$filename");

@NB-Dragon
Copy link
Author

And now, I have fix it in AdvancedDownloader.
Welcome to learn and turn on the star, thanks.

@samamorgan
Copy link

I'm seeing a similar, but opposite issue. Chardet 3.0.4 correctly detected a file as "Windows-1252" (a superset of ISO 8859-1), but 4.0.0 detects gb2312, which is clearly incorrect given the file contents I'm reading. Apologies, I can't share here, this is confidential data.

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

2 participants