Hi all,

I wonder why mb_encode_mimeheader function can't deal with long non-english
strings. Here are the codes:

> function util_encode_mimeheader($headername,$str,$charset) {
> if (function_exists('mb_internal_encoding') &&
> function_exists('mb_encode_mimeheader')) {
>  $x = mb_internal_encoding();
> mb_internal_encoding("UTF-8");
> $y = mb_encode_mimeheader($headername . ": " . $str,
> $charset, "Q");
>  mb_internal_encoding($x);
> return $y;
> }
> }


According to my tests, if the subject have too many characters, there will
be more than one "?UTF-8?Q??" generated which make the MIME header
invaild. If there are more than one "?UTF-8?Q??" , the remaing "?UTF-8?Q?"s
will appear in the body of email, i.e. the beginning of the email will be:

> " =?UTF-8?Q?=E6=9C=89=E9=97=AE=E9=A2=98?=
> Content-type: text/plain; charset=UTF-8 ....".


Can anyone explain this?

Thanks!

Reply via email to