encoding - imap_open() in PHP is not handling UTF-8 -
i using php imap functions read mailbox receives utf-8 encoded plain text email (generated server). accented characters replaced question mark (?). below code , following 2 attempts @ fixing it. how fix problem? have no control on server generates messages, claim encoded utf-8. mb_detect_encoding says imap_body function returning ascii string, i've found mb_detect_encoding buggy in past. $connection = imap_open( '{localhost:993/ssl/novalidate-cert}inbox', 'xxxxxxx', 'xxxxxxx', 0, 1 ); $result = imap_search( $connection, 'unseen' ); if ( $result ) { foreach ( $result $msgno ) { $body = imap_body( $connection, $msgno ); // ... (code process message) ... imap_mail_move( $connection, "$msgno:$msgno", 'inbox.processed' ); } imap_expunge( $connection ); imap_close( $connection ); } } i tried following convert utf-8, though message utf-8: $current_encoding ...