小编Mik*_*old的帖子

IMAP编码和解码:UTF-8问题

我有一个功能,旨在将Gmail帐户中的邮件从一个文件夹移动到另一个文件夹。在移动邮件时,该功能是完全可用的。使用utf-8编码的邮箱时出现我的问题。我解码了IMAP文件夹列表响应,但是两个值的转储给出了不同的结果。

// 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!";
Run Code Online (Sandbox Code Playgroud)

我不知道为什么这两个字符串不匹配,这是我的问题。

php encoding imap utf-8

2
推荐指数
1
解决办法
4463
查看次数

标签 统计

encoding ×1

imap ×1

php ×1

utf-8 ×1