note 50689 added to function.imap-utf7-encode

From: Date: Mon, 07 Mar 2005 13:48:37 +0000
Subject: note 50689 added to function.imap-utf7-encode
Groups: php.notes 
Request: Send a blank email to php-notes+get-86040@lists.php.net to get a copy of this message
<?php /** * @return encoded string * @param string $str * @desc Convert str to UTF-7 imap default mailbox names (the imap_utf7_encode don t built the same result) */ function getEncodedUtf7($str){ if(!$str){ echo "error: you need to give a string parameter."; return false; } # change spaces by entropy because mb_convert fail with spaces $str=ereg_replace(" ","xyxy",$str); # if mb_convert work if($str=mb_convert_encoding($str,"UTF-7")){ # change characters $str=preg_replace("/\+A/","&A",$str); # change to spaces again $str=preg_replace("/xyxy/"," ",$str); # return encoded string return $str; # else }else{ # print error and return false echo "error: is not possible to encode this string '$str'.[". imap_last_error(). "]"; return false; } } ?> ---- Manual Page -- http://www.php.net/manual/en/function.imap-utf7-encode.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+50689 Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+50689&report=yes&reason=added+to+the+manual Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+50689&report=yes&reason=bad+code Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+50689&report=yes&reason=spam Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+50689&report=yes&reason=useless Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+50689&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+50689&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#86040) next »