I have a function which is meant to move a mail from one folder to another on a gmail account. The function is fully functional when it comes to moving the mail. Tho my problem appears when working with utf-8 encoded mailboxes. I decode the IMAP folder list response but the dump of both values gives different results.
// Getting the folders
$folders = imap_list(CONNECTION, MAILBOX, PATTERN);
// After a foreach, stripping slash, prefix and such
// $folder is the raw mailbox name from the IMAP list
$mailbox = utf8_encode(imap_utf7_decode($folder)); // = string(12) "Tæstbåks"
// The entered search from the client
$search_for = "Tæstbåks"; // = string(10) "Tæstbåks"
if($search_for == $mailbox)
print "Yeah!";
else
print "Noo!";
I do not know why those two strings do not match, that is my problem.
bin2hex()of both. Also, why are you usingutf8_encode? - Esailijautf8_encode()to format it correct for viewing. Tryed dosins of different encodings and this were the only method returning the mailbox in a right format. Regarding thebin2hex()function the return value of both is as follows: IMAP Mailbox = string(24) "5400c3a673746200c3a56b73" Serach_for = string(20) "54c3a6737462c3a56b73" So they still don't match - Mikkel NordskjoldNULs - Esailija