Doc #23192 [Com]: mb_encode_mimeheader mangles long lines?
| From: | t dot glaser at tarent dot de | Date: | Mon, 14 Jan 2013 14:12:25 +0000 |
| Subject: | Doc #23192 [Com]: mb_encode_mimeheader mangles long lines? | ||
| References: | 1 | Groups: | php.doc.bugs |
| Request: | Send a blank email to doc-bugs+get-9399@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=23192&edit=1
ID: 23192
Comment by: t dot glaser at tarent dot de
Reported by: jc at mega-bucks dot co dot jp
Summary: mb_encode_mimeheader mangles long lines?
Status: Closed
Type: Documentation Problem
Package: Documentation problem
Operating System: Red Hat Linux 8.0
PHP Version: 4.3.2RC1
Assigned To: moriyoshi
Block user comment: N
Private report: N
New Comment:
This is actually a user error:
$subject
=
"【tokyo-avland】公的証明書の送付期限のお知らせ";
$subject = mb_encode_mimeheader($subject);
Correct it must be:
$subject = mb_encode_mimeheader("Subject: " . $subject);
I was puzzling about that for a long time, too, until I got it: where else is
mb_encode_mimeheader supposed to know when to break from?
Previous Comments:
------------------------------------------------------------------------
[2004-03-15 15:28:37] moriyoshi@php.net
This bug has been fixed in the documentation's XML sources. Since the
online and downloadable versions of the documentation need some time
to get updated, we would like to ask you to be a bit patient.
Thank you for the report, and for helping us make our documentation better.
------------------------------------------------------------------------
[2003-07-30 00:48:24] moriyoshi@php.net
gullevek at gullevek dot org:
If the string is really encoded in ISO-2022-JP already and you are trying to transform it into the
MIME encoded form,
The code should be like the following:
mb_internal_encoding("ISO-2022-JP");
$string=mb_encode_mimeheader(#string, "ISO-2022-JP");
By contrast to other functions, mb_encode_mimeheader() doesn't take any parameter that
specifies the encoding of the source string, if you have to explicitly pass it to the function, you
should call mb_internal_encoding() followed by a mb_encode_mimeheader().
------------------------------------------------------------------------
[2003-07-29 19:57:21] gullevek at gullevek dot org
I have the same line break problem, but my source string is not HTML-ENCODED, it is plain
ISO-2022-JP already, so I can't use $string=mb_encode_mimeheader(mb_convert_encoding($string,
"ISO-2022-JP", "HTML-ENTITIES"),$encoding);
fact is, mb_encode_mimeheaders breaks the line withing an MB string, even it is an mb_ functions.
I have read through the whole thread here and I think, this function is buggy and has to be fixed
ASAP.
At the moment you have to ship around with inserting a single byte whitespace AFTER the 18th
multibyte or 36th single byte character (use mb_strimwidth eg).
------------------------------------------------------------------------
[2003-04-17 20:10:17] jc at mega-bucks dot co dot jp
Ok. Thanks for all the hard work. I'll keep an eye out for when bug #23250 is closed so that I
can understand what HTML-ENTITIES does.
In the meantime I'll try out your solution and see if it works.
------------------------------------------------------------------------
[2003-04-17 08:14:58] moriyoshi@php.net
???! This is still a valid bug report and I've marked as assigned to indicate other volunteers
that I'll fix the part of the document regarding this issue.
As for HTML-ENTITIES, I really feel & admit the insufficiency of docs and so I did register a
new entry for it. See bug #23250.
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=23192
--
Edit this bug report at https://bugs.php.net/bug.php?id=23192&edit=1