Bug #23127 encoding does not supported in outgoing emails
Submitted: 10 Oct 2006 9:41 Modified: 10 Oct 2006 14:23
Reporter: Andrejs Dubovskis Email Updates:
Status: Duplicate Impact on me:
None 
Category:Eventum Severity:S3 (Non-critical)
Version:1.7.1 OS:
Assigned to: CPU Architecture:Any

[10 Oct 2006 9:41] Andrejs Dubovskis
Description:
In our country we are using Latvian and Russian languages in addition to 
English. The Eventum has encoding support for web forms (APP_CHARSET variable in 
the config.inc.php file). And in our environment we have set it value to 'utf8'
But if the system generates an email (notification, etc.) then headers encoded 
according the APP_CHARSET only. The responsible for body encoding headers have 
invalid values:

Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7bit

We have created a small patch, and seems it working at our site. After this 
patch was applied the headers changed to following values:

Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: 8bit

How to repeat:
* set APP_CHARSET to utf8;
* create issue with non-latin symbols;
* read notification;

Suggested fix:
--- ./include/class.mail.php.270906	2006-03-30 22:13:13.000000000 +0300
+++ ./include/class.mail.php	2006-09-27 15:21:10.000000000 +0300
@@ -565,6 +565,8 @@
         $headers = array(
             'From'    => $from,
             'To'      => Mail_API::fixAddressQuoting($to),
+            'Content-Type' => 'text/plain; charset=UTF-8',
+            'Content-Transfer-Encoding' => '8bit',
             'Subject' => $subject
         );
 
@@ -992,4 +994,4 @@
 if (APP_BENCHMARK) {
     $GLOBALS['bench']->setMarker('Included Mail_API Class');
 }
--- ./include/class.notification.php.270906	2006-03-30 22:13:14.000000000 +0300
+++ ./include/class.notification.php	2006-09-27 15:23:43.000000000 +0300
@@ -355,6 +355,8 @@
             // add the warning message about replies being blocked or not
             $fixed_body = Mail_API::addWarningMessage($issue_id, $to, $body);
             $headers['To'] = $to;
+            $headers['Content-Type'] = 'text/plain; charset=UTF-8';
+            $headers['Content-Transfer-Encoding'] = '8bit';
             $mime = new Mail_mime("\r\n");
             $hdrs = $mime->headers($headers);
 
@@ -2089,4 +2091,4 @@
 if (APP_BENCHMARK) {
     $GLOBALS['bench']->setMarker('Included Notification Class');
 }
--- ./include/pear/Mail/mime.php.270906	2006-03-30 22:13:14.000000000 +0300
+++ ./include/pear/Mail/mime.php	2006-09-27 14:36:46.000000000 +0300
@@ -566,7 +566,7 @@
         if (isset($xtra_headers)) {
             $headers = array_merge($headers, $xtra_headers);
         }
-        $this->_headers = array_merge($headers, $this->_headers);
+        $this->_headers = array_merge($this->_headers, $headers) ;
 
         $tmp = $this->_encodeHeaders($this->_headers);
         return $tmp;
[10 Oct 2006 14:23] Bryan Alsdorf
Duplicate of 17267. This is fixed in Eventum 2.0 which will be released sometime in the near future.
[18 Feb 2007 22:41] Mattias Eriksson
I have recently installed Eventum 2.0 beta-1. In this version APP_CHARSET is set to UTF-8 by default. The automated e-mail I receive when I create an issue does not handle Swedish characters.

The line "This is an automated message sent at your request from Brf Kalkonens ärendehanteringssystem." should read "This is an automated message sent at your request from Brf Kalkonens Ärendehanteringssystem."

Regards,
Mattias Eriksson