#36140 [NEW]: mb_encode_mimeheader not working properly
| From: | sugan_b at yahoo dot co dot in | Date: | Tue, 24 Jan 2006 11:15:14 +0000 |
| Subject: | #36140 [NEW]: mb_encode_mimeheader not working properly | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-92408@lists.php.net to get a copy of this message | ||
From: sugan_b at yahoo dot co dot in
Operating system: FC3
PHP version: 5.1.2
PHP Bug Type: mbstring related
Bug description: mb_encode_mimeheader not working properly
Description:
------------
A small part of my application(using only PHP 5.1.2 and Apache 2.2.0)
incorporates mailing functionality which uses "mb_encode_mimeheader()".I
am using ISO-2202-JP charset but Multibyte characters written in
ISO-2202-JP charset code are not sent to the receiver correctly.
Reproduce code:
---------------
index.php
<!-- Start of index.php file -->
<html>
<head>
<meta http-equiv="Content-type" content="text/html; charset=EUC-JP">
<title>test</title> </head> <body> <form method="POST"
action="send.php">
To¡§<input type="text" name="to" size="32"
maxlength="128"
value="sugan_b@yahoo.co.in"/><br>
Subject¡§<input type="text" name="subject" size="128"
maxlength="12 8"
value="¡ÚÌä¹ç¡Û
¥á¡¼¥ë¤ÎSubject¤¬Ê¸»ú²½¤±¤·¤Æ¤·¤Þ¤¤¤Þ¤¹"/><br>
<br> <input
type="submit" value="send" /> </form> </body> </html>
<!-- End of index.php file -->
send.php:
<!-- Start of send.php file -->
<?php
function mailSend($from, $to, $subject, $message) {
$encoded= mb_convert_encoding($subject, "ISO-2022-JP", "EUC-JP");
$sub_mime = mb_encode_mimeheader($encoded, "ISO-2022-JP", "B",
"\r\n");
$body = mb_convert_encoding($message, "ISO-2022-JP", "EUC-JP");
$mp = popen("/usr/sbin/sendmail -f $from $to", "w");
fputs($mp, "Content-Transfer-Encoding: 7bit\r\n");
fputs($mp, "From: ".$from."\r\n");
fputs($mp, "To: ".$to."\r\n");
fputs($mp, "Subject: ".$sub_mime."\r\n");
fputs($mp, "MIME-Version: 1.0\r\n");
fputs($mp, "X-Mailer: test php\r\n");
fputs($mp, "Content-Type: text/plain; charset=\"iso-2022-jp\"");
fputs($mp, "\r\n");
fputs($mp, "$body\r\n");
pclose($mp);
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=EUC-JP">
</head>
<body>
<?php
$from = "sugan_b@yahoo.co.in";
$subject = $_POST['subject'];
$to = $_POST['to'];
$message =
"¿·µ¬Åê¹Æ¤¬¤¢¤Ã¤¿¤³¤È¤ò¤ªÃΤ餻¤·¤Þ¤¹¡£\r\n";
mailSend($from, $to, $subject, $message); ?>
Mail Sending has Completed.
</body>
</html>
<!-- End of send.php file -->
Actual result:
--------------
Actual Result:
The value of Subject field :
問合】
メールのSubjectが8;z2=$1$7$F$7$^$$$^$9
I have configured php using --enable-mbstring=all option.
--
Edit bug report at http://bugs.php.net/?id=36140&edit=1
--
Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=36140&r=trysnapshot44
Try a CVS snapshot (PHP 5.1): http://bugs.php.net/fix.php?id=36140&r=trysnapshot51
Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=36140&r=trysnapshot60
Fixed in CVS: http://bugs.php.net/fix.php?id=36140&r=fixedcvs
Fixed in release: http://bugs.php.net/fix.php?id=36140&r=alreadyfixed
Need backtrace: http://bugs.php.net/fix.php?id=36140&r=needtrace
Need Reproduce Script: http://bugs.php.net/fix.php?id=36140&r=needscript
Try newer version: http://bugs.php.net/fix.php?id=36140&r=oldversion
Not developer issue: http://bugs.php.net/fix.php?id=36140&r=support
Expected behavior: http://bugs.php.net/fix.php?id=36140&r=notwrong
Not enough info: http://bugs.php.net/fix.php?id=36140&r=notenoughinfo
Submitted twice: http://bugs.php.net/fix.php?id=36140&r=submittedtwice
register_globals: http://bugs.php.net/fix.php?id=36140&r=globals
PHP 3 support discontinued: http://bugs.php.net/fix.php?id=36140&r=php3
Daylight Savings: http://bugs.php.net/fix.php?id=36140&r=dst
IIS Stability: http://bugs.php.net/fix.php?id=36140&r=isapi
Install GNU Sed: http://bugs.php.net/fix.php?id=36140&r=gnused
Floating point limitations: http://bugs.php.net/fix.php?id=36140&r=float
No Zend Extensions: http://bugs.php.net/fix.php?id=36140&r=nozend
MySQL Configuration Error: http://bugs.php.net/fix.php?id=36140&r=mysqlcfg