Python3.7+ will "coerce" some variables in the environment to different values.
Currently this is just LC_CTYPE, which will be coerced to the first of
["C.UTF-8", "C.utf8", "UTF-8"] that works on the platform if LC_CTYPE is
interpreted as "C" (such as by being set to "C", or having LC_ALL set to "C" or
other mechanisms) or is set to an invalid value for the platform (such as
"LC_CTYPE=UTF-8" on Linux).
This is a second attempt at the fix I did in D7550. That fix was based off of an
incorrect reading of the code in Python - I had misinterpreted a #if block that
dealt with Android as applying in all situations, and missed some cases where
this would happen and cause issues.