PHP.nl

mb_encode_mimeheader

mb_encode_mimeheader

Encode string for MIME header

string **mb_encode_mimeheader** string $string  $charset  $transfer_encoding string $newline int $indent

Encodes a given by the MIME header encoding scheme. string``string

string The being encoded. Its encoding should be same as . string``mb_internal_encoding

charset specifies the name of the character set in which is represented in. The default value is determined by the current NLS setting (). charset``string``mbstring.language

transfer_encoding specifies the scheme of MIME encoding. It should be either (Base64) or (Quoted-Printable). Falls back to if not given. transfer_encoding``"B"``"Q"``"B"

newline specifies the EOL (end-of-line) marker with which performs line-folding (a term, the act of breaking a line longer than a certain length into multiple lines. The length is currently hard-coded to 74 characters). Falls back to (CRLF) if not given. newline``mb_encode_mimeheaderRFC"\r\n"

indent Indentation of the first line (number of characters in the header before ). string

A converted version of the represented in ASCII. string

Voorbeeld: example

<?php
$name = "太郎"; // kanji
$mbox = "kru";
$doma = "gtinn.mon";
$addr = '"' . addcslashes(mb_encode_mimeheader($name, "UTF-7", "Q"), '"') . '" <' . $mbox . "@" . $doma . ">";
echo $addr;
?>
"=?UTF-7?Q?+WSqQzg-?=" <kru@gtinn.mon>

Opmerking: > This function isn't designed to break lines at higher-level contextual break points (word boundaries, etc.). This behaviour may clutter up the original string with unexpected spaces.

mb_decode_mimeheader