File: explore_platform_encoding.py

package info (click to toggle)
behave 1.2.6-6
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 4,160 kB
  • sloc: python: 19,857; makefile: 137; sh: 18
file content (24 lines) | stat: -rwxr-xr-x 847 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#!/usr/bin/env python
# -*- coding: UTF-8 -*-
"""
Explore encoding settings on a platform.
"""

from __future__ import print_function
import sys
import platform
import locale
from behave.textutil import select_best_encoding

def explore_platform_encoding():
    python_version = platform.python_version()
    print("python %s (platform: %s, %s, %s)" % (python_version, sys.platform,
                                            platform.python_implementation(),
                                            platform.platform()))
    print("sys.getfilesystemencoding():   %s" % sys.getfilesystemencoding())
    print("locale.getpreferredencoding(): %s" % locale.getpreferredencoding())
    print("behave.textutil.select_best_encoding(): %s" % select_best_encoding())
    return 0

if __name__ == "__main__":
    sys.exit(explore_platform_encoding())