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?
- adding new functions
(mb_list_encodings_alias_names(), mb_list_mime_names()) - adding an option to mb_list_encoding().
Regards,
Rui Hirokawa
What do you think about the specification ?
Which way do you prefer to support alias/MIME encoding?
- adding new functions
(mb_list_encodings_alias_names(), mb_list_mime_names())- 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
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