开发者

How to properly display utf encoded characters on my utf-8 encoded page?

开发者 https://www.devze.com 2023-01-01 00:38 出处:网络
I am retrieving emails and some of my emails have utf encoded text. However even though my page is encoded as utf 8 - in some places when I try to out 开发者_Go百科put utf text I get funny characters

I am retrieving emails and some of my emails have utf encoded text. However even though my page is encoded as utf 8 - in some places when I try to out 开发者_Go百科put utf text I get funny characters like:

=?utf-8?B?Rlc6INqp24zYpyDYotm+INin2LMg2YXYs9qp2LHYp9uB2bkg2qnbjCDZhtmC?= 
=?utf-8?B?2YQg2qnYsdiz2qnYqtuSINuB24zaug==?=

Whereas in other areas of the same page it displays fine. What is going on?


It's not "funny characters", those are legitimate ASCII characters. It's just that the string is MIME encoded for transport, so you'll need to put it through mb_decode_mimeheader.


You may be seeing undecoded e-mail headers: =? is the starting delimiter, utf-8 means the text is in utf-8 and B means base-64 encoded. ?= is the ending delimiter. So, base64_decode() the part between the question marks and you'll get the content.

0

精彩评论

暂无评论...
验证码 换一张
取 消