#23192 [Opn->Bgs]: mb_encode_mimeheader mangles long lines?

From: Date: Wed, 16 Apr 2003 20:50:14 +0000
Subject: #23192 [Opn->Bgs]: mb_encode_mimeheader mangles long lines?
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-37773@lists.php.net to get a copy of this message
 ID:               23192
 Updated by:       moriyoshi@php.net
 Reported By:      jc at mega-bucks dot co dot jp
-Status:           Open
+Status:           Bogus
 Bug Type:         mbstring related
 Operating System: Red Hat Linux 8.0
 PHP Version:      4.3.2RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Although mb_send_mail() seems to resolve your problem, the behaviour is
quite by design.

mb_encode_mimeheader is implemented in accordance with section 2
("Syntax of encoded-words") of
RFC2047(http://www.ietf.org/rfc/rfc2047.txt).

---------------------------------------------------------
   An 'encoded-word' may not be more than 75 characters long, including
'charset', 'encoding', 'encoded-text', and delimiters.  If it is
desirable to encode more text than will fit in an 'encoded-word' of 75
characters, multiple 'encoded-word's (separated by CRLF SPACE) may be
used.

   While there is no limit to the length of a multiple-line header
field, each line of a header field that contains one or more
'encoded-word's is limited to 76 characters.
--------------------------------------------------------- EOQ




Previous Comments:
------------------------------------------------------------------------

[2003-04-13 22:09:21] jc at mega-bucks dot co dot jp

Update: The subject is properly encoded *if* I truncate it to be:

$subject =
"【tokyo-avland】公的証明書の送";

This gives the following subject header:

Subject:
=?ISO-2022-JP?B?GyRCIVobKEJ0b2t5by1hdmxhbmQbJEIhWzh4RSo+WkxAPXEkTkF3GyhC?=

------------------------------------------------------------------------

[2003-04-13 21:59:01] jc at mega-bucks dot co dot jp

I am using mb_encode_mimeheader() and it seems that the function does
not work properly on long subject lines ...

$headers  = "MIME-Version: 1.0\n" ;
$headers .= "From: $from <$from_email>\r\n";
$headers .= "Reply-To: $from <$from_email>\r\n";
$headers .= "Content-Type: text/plain;charset=ISO-2022-JP\n";
$body     = mb_convert_encoding($body, "ISO-2022-JP","AUTO");
 
$subject  =
"&#12304;tokyo-avland&#12305;&#20844;&#30340;&#35388;&#26126;&#26360;&#12398;&#36865;&#20184;&#26399;&#38480;&#12398;&#12362;&#30693;&#12425;&#12379;";

/*

 If I cut the subject to be 

  $subject  =
"&#12304;tokyo-avland&#12305;&#20844;&#30340;&#35388;&#26126;&#26360;&#12398;&#36865;&#20184;";
  
  There is no problem. Problems occur if I I put characters
  after this ... This doens't work either:

  $subject  =
"&#12304;tokyo-avland&#12305;&#20844;&#30340;&#35388;&#26126;&#26360;&#12398;&#36865;&#20184;";
  $subject .=
"&#26399;&#38480;&#12398;&#12362;&#30693;&#12425;&#12379;";


*/

mb_language("ja");
$subject = mb_convert_encoding($subject, "ISO-2022-JP","AUTO");
$subject = mb_encode_mimeheader($subject);

mail($to, $subject, $body, $headers, $sendmail_params);


The mail I receive has the following subject line:

Subject:
=?ISO-2022-JP?B?GyRCIVobKEJ0b2t5by1hdmxhbmQbJEIhWzh4RSo+WkxAPXEkTkF3SVU0?=
 =?ISO-2022-JP?B?fDhCJE4kKkNOJGkkOxsoQg==?=

------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=23192&edit=1



Thread (6 messages)

« previous php.bugs (#37773) next »