PHP 8.3.14 Released!

mb_decode_mimeheader

(PHP 4 >= 4.0.6, PHP 5, PHP 7, PHP 8)

mb_decode_mimeheader解码 MIME 头字段中的字符串

说明

mb_decode_mimeheader(string $string): string

解码 MIME 头中编码过的 string string

参数

string

要解码的 string

返回值

以内部(internal)字符编码解码的 string

更新日志

版本 说明
8.3.0 根据 » RFC 2047 规范,将下划线转换为空格。

参见

添加备注

用户贡献的备注 4 notes

up
3
tomlove at gmail dot com
14 years ago
This function ignores any encoded-word specified in a character set not supported by the mbstring extension (e.g. Arabic windows-1256). Such encoded-words pass straight through.

RFC2047 doesn't specify the behaviour, but common agents such as Gmail, Windows Mail, etc. DO NOT ignore such encoded words. They are decoded as if they were declared to be in the local character set.

Be aware of this idiosyncrasy.
up
2
Brett
12 years ago
See also the following functions which may work better in some cases:
iconv_mime_decode() - http://php.net/manual/function.iconv-mime-decode.php
imap_utf8() - http://php.net/manual/function.imap-utf8.php
up
0
hgs at cs dot columbia dot edu
3 years ago
In Q encoding mode, RFC 2047 encodes spaces as _ (Section 4.2).

mb_decode_mimeheader()

does not appear to do this. Thus, to avoid names or subjects with underscores, one needs to apply strtr() or similar function to the input string.

On the other hand, lower-case strings do now work correctly.
up
0
Frogger2000 at gmx dot de
22 years ago
Using quoted-printable-encoding the hex-numbers must be written in uppercase letters!

Works: =?iso-8859-1?q?=3F=3F=3F?=
Fails: =?iso-8859-1?q?=3f=3f=3f?=
To Top