-
Notifications
You must be signed in to change notification settings - Fork 51
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
Input truncated at first NUL byte #27
Comments
Hi @jeffrey-easyesi . I'll check this issue. Thanks. |
Hi @jeffrey-easyesi. I tried it with cChardet v2.0.0: >>> import sys, cchardet
>>> sys.version_info
sys.version_info(major=3, minor=6, micro=0, releaselevel='final', serial=0)
>>> cchardet.detect(open('/bin/sh', 'rb').read())
{'encoding': None, 'confidence': None}
>>> cchardet.detect(open('/usr/bin/vim', 'rb').read())
{'encoding': None, 'confidence': None} |
Python 3.5.2, cChardet v2.0.0 I shouldn't have used /bin/sh as the only example since that's going to look different on different OSes. Try an explicit string like
|
This was referenced Apr 25, 2017
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
When the byte-string passed to
detect
orfeed
has a NUL (\x00) byte inside it, none of the following bytes are actually fed to the detector. This leads to binary files often being detected as ASCII with high confidence:Possibly relevant: https://github.com/cython/cython/wiki/FAQ#how-to-pass-string-buffers-that-may-contain-0-bytes-to-cython
The text was updated successfully, but these errors were encountered: