/usr/lib/python2.7/dist-packages/dispcalGUI/encoding.py is in dispcalgui 1.7.1.6-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | # -*- coding: utf-8 -*-
from encodings.aliases import aliases
import locale
import sys
if sys.stdout.isatty():
if sys.platform == "win32":
try:
from win32console import GetConsoleCP, GetConsoleOutputCP
except ImportError:
pass
def get_encoding(stream):
""" Return stream encoding. """
enc = None
if stream in (sys.stdin, sys.stdout, sys.stderr):
if sys.platform == "darwin":
# There is no way to determine it reliably under OS X 10.4?
return "UTF-8"
elif sys.platform == "win32":
if sys.version_info >= (2, 6):
# Windows/Python 2.6+: If a locale is set, the actual encoding
# of stdio changes, but the encoding attribute isn't updated
enc = locale.getlocale()[1]
if not enc:
try:
if stream is (sys.stdin):
enc = aliases.get(str(GetConsoleCP()))
else:
enc = aliases.get(str(GetConsoleOutputCP()))
except:
pass
enc = enc or getattr(stream, "encoding", None) or \
locale.getpreferredencoding() or sys.getdefaultencoding()
return enc
def get_encodings():
""" Return console encoding, filesystem encoding. """
enc = get_encoding(sys.stdout)
fs_enc = sys.getfilesystemencoding() or enc
return enc, fs_enc
|