File: encoding.py

package info (click to toggle)
displaycal-py3 3.9.16-1
  • links: PTS
  • area: main
  • in suites: forky, sid, trixie
  • size: 29,120 kB
  • sloc: python: 115,777; javascript: 11,540; xml: 598; sh: 257; makefile: 173
file content (15 lines) | stat: -rw-r--r-- 433 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
# -*- coding: utf-8 -*-

import sys


def get_encoding(stream):
    """Return stream encoding."""
    return sys.getdefaultencoding()  # which is "utf-8" for all OSes after Python 3.6


def get_encodings():
    """Return console encoding, filesystem encoding."""
    enc = get_encoding(sys.stdout)  # this is "utf-8" for all OSes
    fs_enc = sys.getfilesystemencoding() or enc  # this is "utf-8" for all OSes
    return enc, fs_enc