mirror of
https://github.com/unode/firefox_decrypt.git
synced 2025-12-16 12:01:52 +01:00
ENH Warn about running with unsupported encodings
This commit is contained in:
@@ -31,6 +31,7 @@ import sys
|
|||||||
import shutil
|
import shutil
|
||||||
from base64 import b64decode
|
from base64 import b64decode
|
||||||
from getpass import getpass
|
from getpass import getpass
|
||||||
|
from itertools import chain
|
||||||
from subprocess import run, PIPE, DEVNULL
|
from subprocess import run, PIPE, DEVNULL
|
||||||
from urllib.parse import urlparse
|
from urllib.parse import urlparse
|
||||||
from configparser import ConfigParser
|
from configparser import ConfigParser
|
||||||
@@ -40,7 +41,7 @@ LOG: logging.Logger
|
|||||||
VERBOSE = False
|
VERBOSE = False
|
||||||
SYSTEM = platform.system()
|
SYSTEM = platform.system()
|
||||||
SYS64 = sys.maxsize > 2**32
|
SYS64 = sys.maxsize > 2**32
|
||||||
DEFAULT_ENCODING = "UTF-8"
|
DEFAULT_ENCODING = "utf-8"
|
||||||
|
|
||||||
PWStore = list[dict[str, str]]
|
PWStore = list[dict[str, str]]
|
||||||
|
|
||||||
@@ -1060,13 +1061,23 @@ def main() -> None:
|
|||||||
|
|
||||||
LOG.info("Running firefox_decrypt version: %s", __version__)
|
LOG.info("Running firefox_decrypt version: %s", __version__)
|
||||||
LOG.debug("Parsed commandline arguments: %s", args)
|
LOG.debug("Parsed commandline arguments: %s", args)
|
||||||
LOG.debug(
|
encodings = (
|
||||||
"Running with encodings: stdin: %s, stdout: %s, locale: %s",
|
("stdin", sys.stdin.encoding),
|
||||||
sys.stdin.encoding,
|
("stdout", sys.stdout.encoding),
|
||||||
sys.stdout.encoding,
|
("stderr", sys.stderr.encoding),
|
||||||
identify_system_locale(),
|
("locale", identify_system_locale()),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
LOG.debug(
|
||||||
|
"Running with encodings: %s: %s, %s: %s, %s: %s, %s: %s",
|
||||||
|
*chain(*encodings)
|
||||||
|
)
|
||||||
|
|
||||||
|
for stream, encoding in encodings:
|
||||||
|
if encoding.lower() != DEFAULT_ENCODING:
|
||||||
|
LOG.warning("Running with unsupported encoding '%s': %s"
|
||||||
|
" - Things are likely to fail from here onwards", stream, encoding)
|
||||||
|
|
||||||
# Load Mozilla profile and initialize NSS before asking the user for input
|
# Load Mozilla profile and initialize NSS before asking the user for input
|
||||||
moz = MozillaInteraction()
|
moz = MozillaInteraction()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user