# iconv_mime_encoding

- Thread: https://externals.io/message/23590
- Original archive: https://news-web.php.net/php.internals/23590
- Started by Oliver Block on 2006-05-20T17:18:29+00:00
- Messages: 3
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #23590 — Oliver Block — 2006-05-20T17:18:29+00:00

URL: https://externals.io/message/23590#23590

Hi,

which sense does it make if a function like iconv_mime_encoding() requires an 
field_name as first argument?

<rfc2822>
Header fields are lines composed of a field name, followed by a colon (":"), 
followed by a field body, and terminated by CRLF. A field name MUST be 
composed of printable US-ASCII characters (i.e., characters that have values 
between 33 and 126, inclusive), except colon.
</rfc2822>

If you use imap_mail() to send the message, you are required to supply a 
subject argument. If you supply the return value of iconv_mime_encoding() 
your will get a subject like that (after decoding by receiver):

Subject: Subject: Hello

Additionally I'd like to say that this iconv_mime_encoding does convert the 
header without any testing if it is required to encode the string. It will 
also encode an US-ASCII string.

Best Regards,

Oliver

---

## #23598 — Derick Rethans — 2006-05-20T23:46:14+00:00

URL: https://externals.io/message/23590#23598 · In reply to: #23590

> which sense does it make if a function like iconv_mime_encoding() requires an 
> field_name as first argument?

It doesn't, but changing it now breaks BC.

Derick

-- 
Derick Rethans
http://derickrethans.nl | http://ez.no | http://xdebug.org

---

## #23614 — Oliver Block — 2006-05-22T12:37:56+00:00

URL: https://externals.io/message/23590#23614 · In reply to: #23598

Am Sonntag, 21. Mai 2006 01:46 schrieb Derick Rethans:
> It doesn't, but changing it now breaks BC.

Hi Derrick,

if you look into RFC4021 there are about 70 header fields, which could be 
created comfortably with the function iconv_mime_encode.

On the other hand there are fields that can be not created comfortably by it 
because of description in my initial mail.

An extension of that function might be a good solution:

I tested supplying a "" for value of field_name which results in

: field body content

If the function would be changed so that one could just supply "" as 
field_name and it would not prepend the field_name and the ": " to the 
field_value the problem would not occur anymore. On the other hand someone 
could have implemented a workaround that split(": ", ...) the return 
value ....

So an additional function like iconv_mime_encoding_value might be a better 
solution which would act like iconv_mime_encoding without requiring (and 
returning) the field_name.

Best Regards,

Oliver
