php Function Mb_EncodeMimeHeader
Article about php function mb_encode_mimeheader
The mb_encode_mimeheader() function encodes a string for use as a MIME header. The parameter charset identifies the character set in which the string is represented and transfer_encoding specifies the scheme for the MIME header encoding (either base64 or quoted-printable). The function performs line-folding and ends with a newline.
The function requires the mbstring extension, and can cause E_USER_NOTICE errors if used with multibyte characters sets unsupported by mbstring. It is recommended to use the encodeHeaderBase64() function instead, which supports multibyte characters. The function also fails to break lines at higher-level contextual break points, such as word boundaries or indentations, which can clutter up the original string with extra spaces. For these reasons, the function should only be called for very short strings. For longer strings, the mb_encode_string() function is more appropriate.