PHP Doku:: Decode string in MIME header field - function.mb-decode-mimeheader.html

Verlauf / Chronik / History: (50) anzeigen

Sie sind hier:
Doku-StartseitePHP-HandbuchFunktionsreferenzUnterstützung menschlicher Sprache und ZeichenkodierungMultibyte StringMultibyte String Funktionenmb_decode_mimeheader

Ein Service von Reinhard Neidl - Webprogrammierung.

Multibyte String Funktionen

<<mb_convert_variables

mb_decode_numericentity>>

mb_decode_mimeheader

(PHP 4 >= 4.0.6, PHP 5)

mb_decode_mimeheaderDecode string in MIME header field

Beschreibung

string mb_decode_mimeheader ( string $str )

Decodes encoded-word string str in MIME header.

Parameter-Liste

str

The string being decoded.

Rückgabewerte

The decoded string in internal character encoding.

Siehe auch


3 BenutzerBeiträge:
- Beiträge aktualisieren...
tomlove at gmail dot com
9.03.2010 19:03
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
18.12.2009 22:16
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
29.05.2002 10:16
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?=



PHP Powered Diese Seite bei php.net
The PHP manual text and comments are covered by the Creative Commons Attribution 3.0 License © the PHP Documentation Group - Impressum - mail("TO:Reinhard Neidl",...)