note 50937 added to function.imap-8bit
| From: | k dot kozlowski at enter dot pl | Date: | Mon, 14 Mar 2005 14:50:39 +0000 |
| Subject: | note 50937 added to function.imap-8bit | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-86403@lists.php.net to get a copy of this message | ||
I had problems with encoding large subjects with polish characters. The problem was that imap_8bit()
splits subject (on 75-th char) but when I add "=?ISO-8859-2?Q?" the header is too long.
This is a solution :
<?php
$subject = str_replace(" ", "_", trim($subject)) ;
// We need to delete "=\r\n" produced by imap_8bit() and replace '?'
$subject = str_replace("?", "=3F", str_replace("=\r\n", "",
imap_8bit($subject))) ;
// Now we split by \r\n but with encoding text "=?ISO ..."
$subject = str_replace("\r\n", "?=\r\n =?ISO-8859-2?Q?", chunk_split($subject,
55)) ;
// We also have to remove last unneeded encoding text :
$subject = "=?ISO-8859-2?Q?" . substr($subject, 0, strlen($subject)-20) . "?=" ;
?>
----
Manual Page -- http://www.php.net/manual/en/function.imap-8bit.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+50937
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50937&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50937&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50937&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50937&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50937&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+50937&report=yes
Search -- http://master.php.net/manage/user-notes.php