packages.chardet.chardetect

Script which takes one or more file paths and reports on their detected encodings

Example:

% chardetect somefile someotherfile
somefile: windows-1252 with confidence 0.5
someotherfile: ascii with confidence 1.0

If no paths are provided, it takes its input from stdin.

Module Contents

Functions

description_of(lines,name=”stdin”) Return a string describing the probable encoding of a file or
main(argv=None) Handles command line arguments and gets things started.
description_of(lines, name="stdin")

Return a string describing the probable encoding of a file or list of strings.

Parameters:
  • lines (Iterable of bytes) – The lines to get the encoding of.
  • name (str) – Name of file or collection of lines
main(argv=None)

Handles command line arguments and gets things started.

Parameters:argv (list of str) – List of arguments, as if specified on the command-line. If None, sys.argv[1:] is used instead.