Bug 493267 - Emails generated by cron are not UTF-8
Emails generated by cron are not UTF-8
Product: Fedora
Classification: Fedora
Component: crontabs (Show other bugs)
All Linux
low Severity medium
: ---
: ---
Assigned To: Marcela Mašláňová
Fedora Extras Quality Assurance
Depends On:
  Show dependency treegraph
Reported: 2009-04-01 03:55 EDT by Dimitris
Modified: 2009-04-03 07:30 EDT (History)
2 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-04-01 04:15:11 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Dimitris 2009-04-01 03:55:12 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:

CONTENT_TYPE="text/plain; charset=utf-8"

in every cron for every user, it should be there by default.

Version-Release number of selected component (if applicable):

all cron versions

How reproducible:


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

Actual results:

UTF-8 strings are not displayed correctly by the email client

Expected results:

They should

Additional info:

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?

Thank you.
Comment 1 Marcela Mašláňová 2009-04-01 04:15:11 EDT
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
Message-Id: <1@mypc>
From: root@mypc (Cron Daemon)
To: root@mypc
Subject: Cron <root@mypc> echo "ěščřžýáí"
Content-Type: text/plain; charset=UTF-8
Auto-Submitted: auto-generated
X-Cron-Env: <SHELL=/bin/bash>
X-Cron-Env: <PATH=/sbin:/bin:/usr/sbin:/usr/bin>
X-Cron-Env: <MAILTO=root>
X-Cron-Env: <HOME=/>
X-Cron-Env: <LOGNAME=root>
X-Cron-Env: <USER=root>

Comment 2 Dimitris 2009-04-01 04:25:56 EDT
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.
Comment 3 Marcela Mašláňová 2009-04-01 04:37:05 EDT
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.
Comment 4 Tomas Mraz 2009-04-01 04:50:01 EDT
rpm -q cronie ?
Comment 5 Dimitris 2009-04-03 06:51:42 EDT
All these below are broken:

Fedora 10:
# rpm -q cronie

Fedora 9:
# rpm -q cronie

CentOS 4.7:
# 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.
Comment 6 Marcela Mašláňová 2009-04-03 07:30:18 EDT
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.

Note You need to log in before you can comment on or make changes to this bug.