Bug #47868 [Com]: Special apostrophe character stripped from subject

From: Date: Thu, 23 Jan 2014 15:22:33 +0000
Subject: Bug #47868 [Com]: Special apostrophe character stripped from subject
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183974@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=47868&edit=1 ID: 47868 Comment by: cmbecker69 at gmx dot de Reported by: cconnors at online-buddies dot com Summary: Special apostrophe character stripped from subject Status: Open Type: Bug Package: Mail related Operating System: win32 only - XPSP2 PHP Version: 5.2.9 Block user comment: N Private report: N New Comment: Hm, the bug description is missing, but it seems astewart is right that this is *not* *a* *bug*. Previous Comments: ------------------------------------------------------------------------ [2012-07-06 20:38:27] astewart at online-buddies dot com Actually, that's not ISO-8859-1, that's Windows-1252: Subject: =?Windows-1252?Q?french d=92avoir?= Which illustrates the problem neatly: You have to know the character encoding in use to make sense of non-ASCII characters. ------------------------------------------------------------------------ [2012-07-06 20:36:37] astewart at online-buddies dot com This is not a bug. The header field must be encoded if you want non-ASCII characters in it, as in: Subject: =?iso-8859-1?Q?french d=92avoir?= ------------------------------------------------------------------------ [2009-04-01 21:30:37] cconnors at online-buddies dot com Description: ------------ The following character (’) is automatically stripped from a subject, but not the body using mail(). Quick fix is... $subj = str_replace('’', '\'', $template->getSubject()); But it's not EXACTLY the same character. I've played around with the header, and cannot get it to work with UTF-8. Reproduce code: --------------- header = "From: ". 'noreply' . " <" . 'noreply@foo.net' . ">\n" . "Reply-To: " . 'noreply@foo.net' . "\n" . "Content-type: text/plain; charset=UTF-8\n\n"; mail('fake@foo.net', 'french d’avoir' , 'french d’avoir', $header); Expected result: ---------------- Should get a message with: subject: french d’avoir body: french d’avoir Actual result: -------------- Actually get: subject: french davoir body: french d’avoir ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=47868&edit=1

« previous php.bugs (#183974) next »