[imp] address book -> compose window

Rong-En Fan rafan at csie.org
Mon Sep 6 03:01:23 PDT 2004


On Sun, Sep 05, 2004 at 09:43:12PM -0400, Chuck Hagenbuch wrote:
> Quoting Rong-En Fan <rafan at csie.org>:
> 
> >second, there are many \ contains in second
> >byte of big5 words, some check in framework/MIME
> >and PEAR's RFC822 does not like \ in name.
> >(yes, they are not multibyte safe, neither)
> 
> By RFC, they *shouldn't* be. Those characters should be encoded.
> 
> -chuck

Yes, but the code path in framework/MIME/MIME.php
will do check before encode those characters:

imp/lib/Compose.php calls MIME::encodeAddress
in sendMessage(), in MIME::encodeAddress:

        require_once 'Mail/RFC822.php';
        $parser = &new Mail_RFC822();
        $addr_arr = $parser->parseAddressList($text, $defserver, false, false);
        $text = '';

        if (is_array($addr_arr)) {
            foreach ($addr_arr as $addr) {
                if (empty($addr->personal)) {
                    $personal = '';
                } else {
                    if ((substr($addr->personal, 0, 1) == '"') &&
                        (substr($addr->personal, -1) == '"')) {
                        $addr->personal = substr($addr->personal, 1, -1);
                    }
                    $personal = MIME::encode($addr->personal, $charset);
                }
                if (strlen($text) != 0) {
                    $text .= ', ';
                }
                $text .= MIME::trimEmailAddress(MIME::rfc822WriteAddress($addr->
            }
        }


As you see, we call RFC822::parseAddressList()
before we do MIME:encode(), then in parseAddressList()
it calls _splitAddresses() which calls _splitCheck().
In _splitCheck() enforces RFC822's address format check.

In my opinion, I think those addresses should be encoded
before using RFC822's parser.

Regards,
Rong-En Fan



More information about the imp mailing list