jpayne@7: # -*- coding: utf-8 -*- jpayne@7: """ jpayne@7: Charset-Normalizer jpayne@7: ~~~~~~~~~~~~~~ jpayne@7: The Real First Universal Charset Detector. jpayne@7: A library that helps you read text from an unknown charset encoding. jpayne@7: Motivated by chardet, This package is trying to resolve the issue by taking a new approach. jpayne@7: All IANA character set names for which the Python core library provides codecs are supported. jpayne@7: jpayne@7: Basic usage: jpayne@7: >>> from charset_normalizer import from_bytes jpayne@7: >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8')) jpayne@7: >>> best_guess = results.best() jpayne@7: >>> str(best_guess) jpayne@7: 'Bсеки човек има право на образование. Oбразованието!' jpayne@7: jpayne@7: Others methods and usages are available - see the full documentation jpayne@7: at . jpayne@7: :copyright: (c) 2021 by Ahmed TAHRI jpayne@7: :license: MIT, see LICENSE for more details. jpayne@7: """ jpayne@7: import logging jpayne@7: jpayne@7: from .api import from_bytes, from_fp, from_path, is_binary jpayne@7: from .legacy import detect jpayne@7: from .models import CharsetMatch, CharsetMatches jpayne@7: from .utils import set_logging_handler jpayne@7: from .version import VERSION, __version__ jpayne@7: jpayne@7: __all__ = ( jpayne@7: "from_fp", jpayne@7: "from_path", jpayne@7: "from_bytes", jpayne@7: "is_binary", jpayne@7: "detect", jpayne@7: "CharsetMatch", jpayne@7: "CharsetMatches", jpayne@7: "__version__", jpayne@7: "VERSION", jpayne@7: "set_logging_handler", jpayne@7: ) jpayne@7: jpayne@7: # Attach a NullHandler to the top level logger by default jpayne@7: # https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library jpayne@7: jpayne@7: logging.getLogger("charset_normalizer").addHandler(logging.NullHandler())