# RFC: about mb_list_encoding() /mb_list_encodings_alias_names( ), mb_list_mime_names( )

- Thread: https://externals.io/message/25806
- Original archive: https://news-web.php.net/php.internals/25806
- Started by Rui Hirokawa on 2006-09-23T22:46:10+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

---

## #25806 — Rui Hirokawa — 2006-09-23T22:46:10+00:00

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

Hi Derick,

Currently, we are discussing about the specification of
mb_list_encoding () and some other related functions such as
mb_list_encodings_alias_names(), mb_list_mime_names()
on mailing list for Japanese PHP developers.

In mbstring, the encoding is defined in the three ways
(1.character encoding,2.its alias, 3.MIME encoding).

mb_list_encoding() returns the list of supported character encodings
in mbstring, but, it doesn't return the alias and MIME encoding.
The list of alias and MIME encoding are also useful for us.

mb_list_encodings_alias_names(), mb_list_mime_names() are
recently added as new functions in PHP_5_2 branch.

mb_list_encodings_alias_names()
 returns the supported list of alias encoding.
mb_list_mime_names()
 returns the supported list of MIME encoding.

The other solution to support list of alias and MIME encoding
is adding an option to mb_list_encoding() such as
 mb_list_encodings([int type])
 type : MB_ENCODING_LISTS_ALL (returns encodings, alias, MIME)
        MB_ENCODING_LISTS_ALIAS (returns alias)
        MB_ENCODING_LISTS_MIME (returns mime)
        MB_ENCODING_LISTS_ENTITY (returns encodings, default for

          backward compatibility)

I know you wrote the function mb_list_encoding() in 2004.

--
Revision 1.211
Mon Mar 8 22:18:03 2004 UTC by derick
Branch: MAIN

- Added mb_list_encoding() to return an array with all mbstring
supported encodings.
--

What do you think about the specification ?
Which way do you prefer to support alias/MIME encoding?
 1. adding new functions
   (mb_list_encodings_alias_names(), mb_list_mime_names())
 2. adding an option to mb_list_encoding().

Regards,

Rui Hirokawa

---

## #25822 — Derick Rethans — 2006-09-25T17:23:05+00:00

URL: https://externals.io/message/25806#25822 · In reply to: #25806

> What do you think about the specification ?
> Which way do you prefer to support alias/MIME encoding?
>  1. adding new functions
>    (mb_list_encodings_alias_names(), mb_list_mime_names())
>  2. adding an option to mb_list_encoding().

I think it should be multiple functions as the return value of the 
functions is different. By making it an option you sorta change the 
total working of a function which I think can be confusing.

regards,
Derick

---

## #25867 — Richard Lynch — 2006-09-28T17:19:20+00:00

URL: https://externals.io/message/25806#25867 · In reply to: #25806

>  mb_list_encodings([int type])
>  type : MB_ENCODING_LISTS_ALL (returns encodings, alias, MIME)
>         MB_ENCODING_LISTS_ALIAS (returns alias)
>         MB_ENCODING_LISTS_MIME (returns mime)
>         MB_ENCODING_LISTS_ENTITY (returns encodings, default for

I personally would prefer this solution over proliferating function
names...

I find it easier to understand the docs and what a function does if I
don't have to flip back and forth between three functions that all do
the same thing, only different.

You could also consider making MB_ENCODING_LISTS_* powers of 2, so that:
mb_list_encodings(MB_ENCODING_LISTS_MIME | MB_ENCODING_LISTS_ENTITY)
returns the expected results.

Disclaimer:
I don't even know what these functions are listing/returning or why
you'd want them... :-)

-- 
Like Music?
http://l-i-e.com/artists.htm
