1# -*- coding: utf-8 -*-
2"""
3Charset-Normalizer
4~~~~~~~~~~~~~~
5The Real First Universal Charset Detector.
6A library that helps you read text from an unknown charset encoding.
7Motivated by chardet, This package is trying to resolve the issue by taking a new approach.
8All IANA character set names for which the Python core library provides codecs are supported.
9
10Basic usage:
11 >>> from charset_normalizer import from_bytes
12 >>> results = from_bytes('Bсеки човек има право на образование. Oбразованието!'.encode('utf_8'))
13 >>> best_guess = results.best()
14 >>> str(best_guess)
15 'Bсеки човек има право на образование. Oбразованието!'
16
17Others methods and usages are available - see the full documentation
18at <https://github.com/Ousret/charset_normalizer>.
19:copyright: (c) 2021 by Ahmed TAHRI
20:license: MIT, see LICENSE for more details.
21"""
22import logging
23
24from .api import from_bytes, from_fp, from_path, is_binary
25from .legacy import detect
26from .models import CharsetMatch, CharsetMatches
27from .utils import set_logging_handler
28from .version import VERSION, __version__
29
30__all__ = (
31 "from_fp",
32 "from_path",
33 "from_bytes",
34 "is_binary",
35 "detect",
36 "CharsetMatch",
37 "CharsetMatches",
38 "__version__",
39 "VERSION",
40 "set_logging_handler",
41)
42
43# Attach a NullHandler to the top level logger by default
44# https://docs.python.org/3.3/howto/logging.html#configuring-logging-for-a-library
45
46logging.getLogger("charset_normalizer").addHandler(logging.NullHandler())