From b309099f0be17c2cda64fde387dc6b2ba1c839a2 Mon Sep 17 00:00:00 2001 From: SanderJo Date: Thu, 23 Feb 2017 21:45:34 +0100 Subject: [PATCH] Warning in case of non-UTF-8 setting on Linux/Unix --- SABnzbd.py | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/SABnzbd.py b/SABnzbd.py index 0e7b185..61aa963 100755 --- a/SABnzbd.py +++ b/SABnzbd.py @@ -1169,11 +1169,18 @@ def main(): logging.info('Platform = %s', os.name) logging.info('Python-version = %s', sys.version) logging.info('Arguments = %s', sabnzbd.CMDLINE) + + # Find encoding; relevant for unrar activities try: - logging.info('Preferred encoding = %s', locale.getpreferredencoding()) + preferredencoding = locale.getpreferredencoding() + logging.info('Preferred encoding = %s', preferredencoding) except: logging.info('Preferred encoding = ERROR') + preferredencoding = '' + # On Linux/FreeBSD/Unix "UTF-8" is strongly, strongly adviced: + if not sabnzbd.WIN32 and not sabnzbd.DARWIN and not ('utf' in preferredencoding.lower() and '8' in preferredencoding.lower()): + logging.warning(T("SABnzbd was started with encoding %s, this should be UTF-8. Expect problems with Unicoded file and directory names in downloads.") % preferredencoding) if sabnzbd.cfg.log_level() > 1: from sabnzbd.getipaddress import localipv4, publicipv4, ipv6