From 582b981afa99bfb1d338f6efe6999993b112d546 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Wed, 14 Oct 2020 19:15:48 +0100 Subject: [PATCH 1/3] Locale: Be even more paranoid about setting UTF-8 encoding * Only set if not on win32, or if we are and a known good version of Windows 10 (or later). --- EDMarketConnector.py | 41 ++++++++++++++++++++++++++++++----------- 1 file changed, 30 insertions(+), 11 deletions(-) diff --git a/EDMarketConnector.py b/EDMarketConnector.py index 3e1ace27..90ff631f 100755 --- a/EDMarketConnector.py +++ b/EDMarketConnector.py @@ -1123,18 +1123,37 @@ sys.path: {sys.path}''' locale_startup = locale.getlocale(locale.LC_CTYPE) logger.debug(f'Locale LC_CTYPE: {locale_startup}') - # Set that same language, but utf8 encoding (it was probably cp1252 - # or equivalent for other languages). - # UTF-8, not utf8: - try: - # locale_startup[0] is the 'language' portion - locale.setlocale(locale.LC_ALL, (locale_startup[0], 'UTF-8')) + # Older Windows Versions and builds have issues with UTF-8, so only + # even attempt this where we think it will be safe. - except locale.Error as e: - logger.error(f"Could not set LC_ALL to ({locale_startup[0]}, 'UTF_8')", exc_info=e) - - else: - log_locale('After switching to UTF-8 encoding (same language)') + if sys.platform == 'win32': + windows_ver = sys.getwindowsversion() + + # + # Windows 19, 1903 was build 18362 + if ( + sys.platform != 'win32' + or ( + windows_ver.major == 10 + and windows_ver.build >= 18362 + ) + or windows_ver.major > 10 # Paranoid future check + ): + # Set that same language, but utf8 encoding (it was probably cp1252 + # or equivalent for other languages). + # UTF-8, not utf8: + try: + # locale_startup[0] is the 'language' portion + locale.setlocale(locale.LC_ALL, (locale_startup[0], 'UTF-8')) + + except locale.Error: + logger.exception(f"Could not set LC_ALL to ('{locale_startup[0]}', 'UTF_8')") + + except Exception: + logger.exception(f"Exception other than locale.Error on setting LC_ALL=('{locale_startup[0]}', 'UTF_8')") + + else: + log_locale('After switching to UTF-8 encoding (same language)') # TODO: unittests in place of these # logger.debug('Test from __main__') From 64f203517defa5bef619957cda67da413fe099cd Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 15 Oct 2020 11:49:30 +0100 Subject: [PATCH 2/3] Release 4.1.4 --- ChangeLog.md | 11 +++++++++++ config.py | 2 +- 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/ChangeLog.md b/ChangeLog.md index eedceac0..e6d07440 100644 --- a/ChangeLog.md +++ b/ChangeLog.md @@ -1,6 +1,17 @@ This is the master changelog for Elite Dangerous Market Connector. Entries are in reverse chronological order (latest first). --- +Release 4.1.4 +=== + +The only change from 4.1.3 is to insert some Windows version checks before +even attempting to set a UTF-8 encoding. We'll now only attempt this if the +user is *not* on Windows, or is on at least Windows 10 1903. + +For unknown reasons no exception was being thrown under some circumstances (in +this case running under an earlier Windows 10, but with EDMarketConnector.exe +set to run in Windows 7 compatibility mode for some unknown reason). + Release 4.1.3 === diff --git a/config.py b/config.py index 3dcdca95..880f559d 100644 --- a/config.py +++ b/config.py @@ -13,7 +13,7 @@ appcmdname = 'EDMC' # appversion **MUST** follow Semantic Versioning rules: # # Major.Minor.Patch(-prerelease)(+buildmetadata) -appversion = '4.1.3' #-rc1+a872b5f' +appversion = '4.1.4' #-rc1+a872b5f' # For some things we want appversion without (possible) +build metadata appversion_nobuild = str(semantic_version.Version(appversion).truncate('prerelease')) copyright = u'© 2015-2019 Jonathan Harris, 2020 EDCD' From 69c94f05151ef7f0e528a6896f036e873f458036 Mon Sep 17 00:00:00 2001 From: Athanasius Date: Thu, 15 Oct 2020 11:53:06 +0100 Subject: [PATCH 3/3] appcast 4.1.4 --- edmarketconnector.xml | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/edmarketconnector.xml b/edmarketconnector.xml index a8e751fc..83782562 100644 --- a/edmarketconnector.xml +++ b/edmarketconnector.xml @@ -168,11 +168,19 @@ - Release 4.1.3 + Release 4.1.4 body { font-family:"Segoe UI","Tahoma"; font-size: 75%; } h2 { font-family:"Segoe UI","Tahoma"; font-size: 105%; } +

Release 4.1.4

+

The only change from 4.1.3 is to insert some Windows version checks before +even attempting to set a UTF-8 encoding. We'll now only attempt this if the +user is not on Windows, or is on at least Windows 10 1903.

+

For unknown reasons no exception was being thrown under some circumstances (in +this case running under an earlier Windows 10, but with EDMarketConnector.exe +set to run in Windows 7 compatibility mode for some unknown reason).

+

Release 4.1.3

  • @@ -816,11 +824,11 @@ If any of your plugins are listed in that section then they will need updating, ]]>