Bug 493267

Summary: Emails generated by cron are not UTF-8
Product: [Fedora] Fedora Reporter: Dimitris <centos>
Component: crontabsAssignee: Marcela Mašláňová <mmaslano>
Status: CLOSED WORKSFORME QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: low    
Version: rawhideCC: mmaslano, tmraz
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2009-04-01 08:15:11 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Dimitris 2009-04-01 07:55:12 UTC
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:

always


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 08:15:11 UTC
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 08:25:56 UTC
weird, this isn't working here.

my locale settings in /etc/sysconfig/i18n are:

LANG="en_US.UTF-8"

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 08:37:05 UTC
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 08:50:01 UTC
rpm -q cronie ?

Comment 5 Dimitris 2009-04-03 10:51:42 UTC
All these below are broken:

Fedora 10:
# rpm -q cronie
cronie-1.2-7.fc10.i386

Fedora 9:
# rpm -q cronie
cronie-1.0-7.fc9.x86_64

CentOS 4.7:
# rpm -qa |grep -i cron
vixie-cron-4.1-50.el4
crontabs-1.10-7


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 11:30:18 UTC
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.