From: Oleg Broytman Date: Sun, 16 Apr 2017 11:54:47 +0000 (+0300) Subject: Move defenc.py to a separate namespace package X-Git-Tag: 3.1.0~9 X-Git-Url: https://git.phdru.name/?a=commitdiff_plain;h=09065c542610c2d629f5a7d6f8c38baca62fb01c;p=m_lib.git Move defenc.py to a separate namespace package --- diff --git a/m_lib/defenc.py b/m_lib/defenc.py deleted file mode 100755 index 776b78d..0000000 --- a/m_lib/defenc.py +++ /dev/null @@ -1,37 +0,0 @@ -#! /usr/bin/env python -"""Get default encoding""" - -from __future__ import print_function -import sys - -try: - import locale - use_locale = True -except ImportError: - use_locale = False - -__all__ = ['default_encoding'] - -if use_locale: - # Get the default charset. - try: - lcAll = locale.getdefaultlocale() - except locale.Error as err: - print("WARNING:", err, file=sys.stderr) - lcAll = [] - - if len(lcAll) == 2 and lcAll[0] is not None: - default_encoding = lcAll[1] - else: - try: - default_encoding = locale.getpreferredencoding() - except locale.Error as err: - print("WARNING:", err, file=sys.stderr) - default_encoding = sys.getdefaultencoding() -else: - default_encoding = sys.getdefaultencoding() - -default_encoding = default_encoding.lower() - -if __name__ == "__main__": - print(default_encoding)