Comments (6)
maybe this can also solve the problem, I mentioned before, #60
@dan-blanchard @sigmavirus24
from chardet.
any response???about this issue???@dan-blanchard
from chardet.
Since chardet uses statistics to determine encodings, it has poor performance for short strings.
Also, we must only rely on multi-byte characters for determining if a string is UTF-8 because we want to be able to detect single-byte encodings like ASCII and Windows-1252.
Could you please explain what exactly you're trying to use chardet for and how you're calling it? Did you run chardet.detect(b'FAHR%E2%80%A2WERK')
?
from chardet.
No, I run somethink like this
import urlparse
import chardet
a = 'FAHR%E2%80%A2WERK'
b = urlparse.unquote(a)
chardet.detect(b)
I use it mainly for detect short characters, such as website's title.
In china, japan or somewhere else, website use not only utf-8 but also gbk, shift-jis, etc. So I need to detect what kind of character the title is, then translate them into utf-8. And people sometime likes to add some special symbols into the title like '★','•'. These thing may make the detecting failed.
I got another example, may be it's not so good
chardet.detect("'我' means I in chinese")
from chardet.
Have a similar problem, running chardet on a simple python file containing umlauts which reads totally fine when just using utf-8, but chardet detects iso-8859-2
. Here's our code: https://gitlab.com/coala/coala-utils/commit/d5b707689a150d1c561d3fa0912e5d1cb79f0441#59e25ab47f5113468cf960272779acd36dcfb680_0_38 which fails the test
from chardet.
chardet is inaccurate for short strings, as has been stated many times. Being able to restrict the encoding set as suggested in #70 would go a long way to fixing some of these common issues, so I will prioritize adding that in the next version.
from chardet.
Related Issues (20)
- detect encode wrong!
- Detect pep-0263
- test_detect_all_and_detect_one_should_agree fails on Python 3.11b3 HOT 4
- Dependency warning (v5.0.0) HOT 1
- chardet 5.0 KeyError with Python 3.10 on Windows HOT 5
- Is the license LGPL v2.1 or later or just LGPLv2.1 only? HOT 3
- Documentation licensed only to non-commercial and personal use found
- Documentation licensed only to non-commercial and personal use found HOT 1
- Allow running of the package via `python3 -m chardet ...` HOT 4
- Encoding error
- Next release for Python 3.11 HOT 1
- type annotation and implementation mismatch HOT 2
- How to use Chardet for this Python code, as to read files that have ANSI encoder?
- chardetect cli: UnicodeEncodeError when filename is not utf8
- wrong result. actual johab - expected latin1 HOT 4
- Failed to detect CP932 encoded file
- pip intall chardet
- `chardet.detect` a lot slower than using `UniversalDetector.feed` with chunks
- chardet detect UTF-8 XML File as EUC_KR - Possibility to exclude encodings?
- Wrong detection UTF-8 with ö symbol
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from chardet.