How to change the subject info of Gmail into Chinese character?

132 views Asked by At

I got a string =?GB2312?B?zbO8xtGnu/m0ocq10bXP7sS/?= with $overview[0]->subject; in imap_fetch_overview function .

How to change the subject info of Gmail into Chinese character?

1

There are 1 answers

1
Grokify On BEST ANSWER

Your string is a MIME RFC 2047 encoded word which can be decoded using PHP's mb_decode_mimeheader and mb_internal_encoding functions.

To convert your MIME encoded string to UTF-8, you can use the following code:

mb_internal_encoding('UTF-8');
echo mb_decode_mimeheader('=?GB2312?B?zbO8xtGnu/m0ocq10bXP7sS/?=');
# result: 统计学基础实训项目