Skip to content

ASCII text with null separators detected as utf-16-be #346

@jkugler

Description

@jkugler

Under chardet 5.x, this string is detected as ascii, but under 7.1.0, it is detected as utf-16-be.

>>> chardet.__version__
'5.2.0'
>>> s = b'master:README.md\x002\x00For support slack to #kodiak-support\nmaster:support.txt\x001\x00For support slack to #kodiak-support\n'
>>> chardet.detect(s)
{'encoding': 'ascii', 'confidence': 1.0, 'language': ''}

But:

>>> chardet.__version__
'7.1.0'
>>> chardet.detect(s)
{'encoding': 'utf-16-be', 'confidence': 0.95, 'language': 'zh'}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions