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

encodings.
This commit is contained in:
Derick Rethans 2004-03-08 22:18:05 +00:00
parent 14bdcf810a
commit b3b2192a1e
5 changed files with 29 additions and 0 deletions

2
NEWS
View File

@ -3,6 +3,8 @@ PHP NEWS
?? March 2004, PHP 5 Release Candidate 1
- Changed Iterator::has_more() to Iterator::valid(). (Marcus)
- Upgraded bundled oniguruma library to version 2.2.2. (Rui, Moriyoshi)
- Added mb_list_encoding() to return an array with all mbstring supported
encodings. (Derick)
- Added support for more ISO8601 style datetime formats. (Moriyoshi)
. Timezone specifier (ex. "20040301T02:00:00+19:00")
. Week specifier (ex. "1997W021")

View File

@ -264,6 +264,12 @@ mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding)
}
}
const mbfl_encoding **
mbfl_get_supported_encodings(void)
{
return mbfl_encoding_ptr_list;
}
const char *
mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding)
{

View File

@ -117,6 +117,7 @@ typedef struct _mbfl_encoding {
MBFLAPI extern const mbfl_encoding * mbfl_name2encoding(const char *name);
MBFLAPI extern const mbfl_encoding * mbfl_no2encoding(enum mbfl_no_encoding no_encoding);
MBFLAPI extern enum mbfl_no_encoding mbfl_name2no_encoding(const char *name);
MBFLAPI extern const mbfl_encoding ** mbfl_get_supported_encodings();
MBFLAPI extern const char * mbfl_no_encoding2name(enum mbfl_no_encoding no_encoding);
MBFLAPI extern const char * mbfl_no2preferred_mime_name(enum mbfl_no_encoding no_encoding);
MBFLAPI extern int mbfl_is_support_encoding(const char *name);

View File

@ -196,6 +196,7 @@ function_entry mbstring_functions[] = {
PHP_FE(mb_strimwidth, NULL)
PHP_FE(mb_convert_encoding, NULL)
PHP_FE(mb_detect_encoding, NULL)
PHP_FE(mb_list_encodings, NULL)
PHP_FE(mb_convert_kana, NULL)
PHP_FE(mb_encode_mimeheader, NULL)
PHP_FE(mb_decode_mimeheader, NULL)
@ -2235,6 +2236,24 @@ PHP_FUNCTION(mb_detect_encoding)
}
/* }}} */
/* {{{ proto array mb_list_encodings()
Returns an array of all supported encodings */
PHP_FUNCTION(mb_list_encodings)
{
const mbfl_encoding **encodings;
const mbfl_encoding *encoding;
int i;
array_init(return_value);
i = 0;
encodings = mbfl_get_supported_encodings();
while ((encoding = encodings[i++]) != NULL) {
add_next_index_string(return_value, encoding->name, 1);
}
}
/* }}} */
/* {{{ proto string mb_encode_mimeheader(string str [, string charset [, string transfer-encoding [, string linefeed]]])
Converts the string to MIME "encoded-word" in the format of =?charset?(B|Q)?encoded_string?= */
PHP_FUNCTION(mb_encode_mimeheader)

View File

@ -111,6 +111,7 @@ PHP_FUNCTION(mb_strwidth);
PHP_FUNCTION(mb_strimwidth);
PHP_FUNCTION(mb_convert_encoding);
PHP_FUNCTION(mb_detect_encoding);
PHP_FUNCTION(mb_list_encodings);
PHP_FUNCTION(mb_convert_kana);
PHP_FUNCTION(mb_encode_mimeheader);
PHP_FUNCTION(mb_decode_mimeheader);