I have a very simple python command
python3 -c "print(b'\xe9'.decode('iso-8859-1'))"
When I run it from the command prompt it works fine. However, if I wrap it in a service and place it in /etc/init/test_service
like this
description "test of iso-8859-1 issue"
start on runlevel [2345]
stop on runlevel [!2345]
setuid www-data
setgid www-data
script
exec python3 -c "print(b'\xe9'.decode('iso-8859-1'))"
end script
Then it fails with error
Traceback (most recent call last):
File "<string>", line 1, in <module>
UnicodeEncodeError: 'ascii' codec can't encode character '\xe9' in position 0: ordinal not in range(128)
Most of the other answers I've found don't assume you need to install something to make iso-8859-1
available.