From 09065c542610c2d629f5a7d6f8c38baca62fb01c Mon Sep 17 00:00:00 2001 From: Oleg Broytman Date: Sun, 16 Apr 2017 14:54:47 +0300 Subject: [PATCH] Move defenc.py to a separate namespace package --- m_lib/defenc.py | 37 ------------------------------------- 1 file changed, 37 deletions(-) delete mode 100755 m_lib/defenc.py 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) -- 2.39.5