多字节字符串 函数
在线手册:中文  英文

mb_decode_mimeheader

(PHP 4 >= 4.0.6, PHP 5)

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

说明

string mb_decode_mimeheader ( string $str )

解码 MIME 头中编码过的字符串 str

参数

str

要解码的 string

返回值

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

参见


多字节字符串 函数
在线手册:中文  英文

用户评论:

Brett (2012-02-27 03:35:00)

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

tomlove at gmail dot com (2010-03-09 10:03:45)

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.

Dmitri Snytkine (2009-12-18 13:16:04)

This function leaves the underscores in the string.
For example, the mime header looks like this:
$text = "=?ISO-8859-1?Q?Keld_J=F8rn_Simonsen?= <keld@example.com>";

Then I decode this string like this:

<?php
mb_internal_encoding
("UTF-8");
$ret2 mb_decode_mimeheader($text);
?>

The result is decoded string which looks OK except that the underscores between the first, middle and last names are still there.

Keld_J?rn_Simonsen

imap_utf8($text) does not show underscores, which is the correct way, except that on my Windows PC the imap_utf8() converts result to upper case, which is a known bug.

Frogger2000 at gmx dot de (2002-05-29 01:16:55)

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?=

易百教程