Skip to content

[BUG] Wrong way to get list of supported encodings #323

@nickspring

Description

@nickspring

Describe the bug
It looks like you get list of encodings from encoding.aliases module.
aliases(as one would/should expect) contains several cases where different keys are mapped to the same value e.g. 1252 and windows_1252 are both mapped to cp1252. You could save time if instead of aliases.keys() you use set(aliases.values()).

BUT THERE'S A WORSE PROBLEM: aliases don't contain codecs that don't have aliases (like cp856, cp874, cp875, cp737, and koi8_u).

To Reproduce
List of encodings, supported by this library:
https://charset-normalizer.readthedocs.io/en/latest/user/support.html#supported-encodings
It's declared that the library supports all encodings which are supported by Python.
But there is no, for example, KOI8-U.

Expected behavior
But KOI8-U is supported (but just it doesn't have an alias):
https://docs.python.org/3.11/library/codecs.html#standard-encodings

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