谷歌编码问题base64和PHP解码

时间:2011-12-04 22:53:34

标签: php character-encoding base64 content-type

好的我有一个复杂的问题。我会尽力解释清楚。

我正在将电子邮件从谷歌转发到PHP脚本。如果我使用“@”符号,它会将其编码为base 64,如下所示。我可以解码它,但有时电子邮件没有“@”符号所以它不会在电子邮件中编码...如果我在我的PHP代码中运行base64脚本,它会解码,即使它没有必须和搞乱文本。

有意义吗?

以下是一个被编码的示例,因为使用了“@”符号:

Example ONE I sent this: sample@sample.com
=============================================
The email came out like this.

Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes
Content-Transfer-Encoding: base64

U2FtcGxloXNhbXBsZS5jb20NCg0KLS0NClNlbnQgdXNpbmcgU01TLXRvLWVtYWlsLiAgUmVwbHkg
dG8gdGhpcyBlbWFpbCB0byB0ZXh0IHRoZSBzZW5kZXIgYmFjayBhbmQgIA0Kc2F2ZSBvbiBTTVMg
ZmVlcy4NCmh0dHBzOi8vd3d3Lmdvb2dsZS5jb20vdm9pY2UNCg==

------------------------------------------------------
------------------------------------------------------


Example TWO I sent this: Hello World
======================================================
The email came like this:

Content-Type: text/plain; charset=ISO-8859-1; format=flowed; delsp=yes

Hello world

如何测试其编码,然后如何正确编码?

非常感谢。

-Ed

1 个答案:

答案 0 :(得分:2)

答案就在那里,请看下面的标题:

Content-Transfer-Encoding: base64

它告诉您内容使用base64编码进行编码。

相关问题