Red Hat Bugzilla – Bug 493267
Emails generated by cron are not UTF-8
Last modified: 2009-04-03 07:30:18 EDT
Description of problem:
While RHEL and Fedora are using UTF-8 (or at least as much as possible), the emails generated by cron are not UTF-8, they are missing a proper content header.
This means that output generated by the executed scripts is not displayed correctly by the email client, since the email defaults to us-ascii. In order to fix this, we need to add:
in every cron for every user, it should be there by default.
Version-Release number of selected component (if applicable):
all cron versions
Steps to Reproduce:
1. create a script which echoes some UTF-8 string
2. create a cron job which executes the script
3. wait for the email to come and read it, the string appears like garbage
UTF-8 strings are not displayed correctly by the email client
cron doesn't break the characters, it properly passes them on to the email, the problem is that the email is missing the proper content header to tell the email client that this email is UTF-8.
since RHEL/Fedora are using UTF-8, shouldn't the emails contain that header by default?
Yes, if we have whole system in UTF-8 then also emails by cron should be in UTF-8. The header in email is created from local. If your local are UTF-8 then the email will be in UTF-8. You can check body of your email f.e. in /var/mail/user.
Date: Wed, 1 Apr 2009 10:09:01 +0200
From: root@mypc (Cron Daemon)
Subject: Cron <root@mypc> echo "ěščřžýáí"
Content-Type: text/plain; charset=UTF-8
weird, this isn't working here.
my locale settings in /etc/sysconfig/i18n are:
The content-type header is missing in my cron emails, unless i add the CONTENT_TYPE in the crontab by hand.
I'll do some more tests with Fedora 10 and report my results.
It depends also on setting of the mail reader. And if you have broken subject don't worry. Another fixing subject could bring more bugs because now it's working for most of users.
Also you can have setting in your crontab which override the utf-8 on your system. If you have reproducer please feel free to reopen this bug.
rpm -q cronie ?
All these below are broken:
# rpm -q cronie
# rpm -q cronie
# rpm -qa |grep -i cron
Unfortunately, i couldn't test rawhide or Fedora 11 Alpha, maybe the bug was fixed there? I guess my bug report is wrong, i shouldn't have selected rawhide in the version dropdown.
I have tested the same version on F-10 and it's still worksforme. Could you tell me more about setting? The problem will be probably else. What do you use for reading mails, what are the second language, which has the utf-8 characters, which are incorrect in mail output. The fix for UTF-8 is there since F-5 and it is also in RHEL-5. I'm not sure about RHEL-4.