Commit 8ea42847 authored by Joshua Tauberer's avatar Joshua Tauberer

nightly status checks could fail if any domains had non-ASCII characters

https://discourse.mailinabox.email/t/status-check-emails-empty-after-upgrading-to-v0-16/1082/3

A user on that thread suggests an alternate solution, adding `PYTHONIOENCODING=utf-8` to `/etc/environment`. Python docs say that affects stdin/out/err. But we also use these environment variables elsewhere to ensure that config files we read/write are opened with UTF8 too. Maybe all that can be simplified too.
parent 4ed23f44
...@@ -8,6 +8,7 @@ In Development ...@@ -8,6 +8,7 @@ In Development
* On multi-homed machines, Postfix now binds to the right network interface when sending outbound mail so that SPF checks on the receiving end will pass. * On multi-homed machines, Postfix now binds to the right network interface when sending outbound mail so that SPF checks on the receiving end will pass.
* Backup times were displayed with the wrong time zone. * Backup times were displayed with the wrong time zone.
* On low-usage systems, don't hold backups for quite so long by taking a full backup more often. * On low-usage systems, don't hold backups for quite so long by taking a full backup more often.
* Nightly status checks might fail if any domains had non-ASCII characters.
v0.16 (January 30, 2016) v0.16 (January 30, 2016)
------------------------ ------------------------
......
...@@ -27,9 +27,9 @@ EXEC_AS_USER=root ...@@ -27,9 +27,9 @@ EXEC_AS_USER=root
# Ensure Python reads/writes files in UTF-8. If the machine # Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding, # triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in # Python may not be able to read/write files. Set also
# setup/start.sh (where the locale is also installed if not # setup/start.sh (where the locale is also installed if not
# already present). # already present) and management/daily_tasks.sh.
export LANGUAGE=en_US.UTF-8 export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8 export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8 export LANG=en_US.UTF-8
......
#!/bin/bash #!/bin/bash
# This script is run daily (at 3am each night). # This script is run daily (at 3am each night).
# Set character encoding flags to ensure that any non-ASCII
# characters don't cause problems. See setup/start.sh and
# the management daemon startup script.
export LANGUAGE=en_US.UTF-8
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
export LC_TYPE=en_US.UTF-8
# Take a backup. # Take a backup.
management/backup.py | management/email_administrator.py "Backup Status" management/backup.py | management/email_administrator.py "Backup Status"
......
...@@ -10,8 +10,8 @@ source setup/preflight.sh ...@@ -10,8 +10,8 @@ source setup/preflight.sh
# Ensure Python reads/writes files in UTF-8. If the machine # Ensure Python reads/writes files in UTF-8. If the machine
# triggers some other locale in Python, like ASCII encoding, # triggers some other locale in Python, like ASCII encoding,
# Python may not be able to read/write files. Here and in # Python may not be able to read/write files. This is also
# the management daemon startup script. # in the management daemon startup script and the cron script.
if [ -z `locale -a | grep en_US.utf8` ]; then if [ -z `locale -a | grep en_US.utf8` ]; then
# Generate locale if not exists # Generate locale if not exists
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment