If the data in the DB is always iso-8859-1, you can encode header values thus:

"From: =?iso-8859-1?b?" . base64_encode($fullname) . "?="

There shouldn't be any need to perform charset conversion; you just put the actual charset name in that first bit; MIME (actually rfc2047) aware MUAs will decode appropriately.

--Wez (sometime mail hacker)

On Jul 14, 2009, at 6:02 AM, Gwynne Raskind wrote:

gwynne          Tue, 14 Jul 2009 10:02:22 +0000

URL: http://svn.php.net/viewvc?view=revision&revision=284067

Changed paths:
        U   SVNROOT/commit-email.php

Log:
Okay, I give up. Full names are now encoded LOSSILY as ASCII. Also added a
couple of missing which-list expressions.

Modified: SVNROOT/commit-email.php
===================================================================
--- SVNROOT/commit-email.php    2009-07-14 09:57:09 UTC (rev 284066)
+++ SVNROOT/commit-email.php    2009-07-14 10:02:22 UTC (rev 284067)
@@ -17,6 +17,7 @@
    '|^gtk/php-gtk-web|' => array('gtk-webmas...@php.net'),
    '|^gtk/php-gtk-doc|' => array('php-gtk-...@lists.php.net'),
    '|^gtk/php-gtk|' => array('php-gtk-...@lists.php.net'),
+    '|^gtk|' => array('php-gtk-...@lists.php.net'),

    // Web
    '|^web/bugtracker|' => array('php-webmas...@lists.php.net'),
@@ -67,6 +68,7 @@
    '|^phd|' => array('doc-...@lists.php.net'),
    '|^web/doc|' => array('doc-...@lists.php.net'),
    '|^doc-editor|' => array('doc-...@lists.php.net'),
+    '|^phpdoc|' => array('doc-...@lists.php.net'),

    // PEAR
    '|^pear/pearbot|' => array('pear-...@lists.php.net'),
@@ -119,9 +121,7 @@
        $saw_last_ISO = TRUE;
    }
    if ($username === $commit_user) {
-        if (!$saw_last_ISO) {
- $fullname = iconv("ISO-8859-1", "UTF-8//TRANSLIT", $fullname);
-        }
+ $fullname = str_replace(array('~', "'", '"'), '', iconv($saw_last_ISO ? "UTF-8" : "ISO-8859-1", "ASCII//TRANSLIT", $fullname));
        $from = "\"{$fullname}\" <{$userna...@php.net>";
        break;
    }
@@ -164,7 +164,7 @@
// Build e-mail
$boundary = sha1("{$commit_user}{$commit_date}");

-$msg_headers = "From: " . imap_8bit($from) . "\r\n" .
+$msg_headers = "From: {$from}\r\n" .
               "To: " . implode(', ', $emails_to) . "\r\n" .
"Message-ID: <svn{$commit_user}{$commit_da...@svn.php.net >\r\n" .
               "Date: " . date(DATE_RFC822, $commit_date) . "\r\n" .

--
SVN Migration Project Mailing List (http://svn.php.net)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to