diff options
author | Yasuo Ohgaki <yohgaki@php.net> | 2014-02-13 11:56:54 +0900 |
---|---|---|
committer | Yasuo Ohgaki <yohgaki@php.net> | 2014-02-13 11:56:54 +0900 |
commit | 9a5cb51ebcb778b0cac39928fb6fcd5c604fe6cd (patch) | |
tree | 196bec3fad7cd0e8f2a26bc298b803d2383d0f58 | |
parent | c9e9151bb3c5bc2e257a9e23d53b6f0234aac743 (diff) | |
parent | cbd108abf19d9fb9ae1d4ccd153215f56a2763e8 (diff) | |
download | php-git-9a5cb51ebcb778b0cac39928fb6fcd5c604fe6cd.tar.gz |
Merge branch 'PHP-5.6'
* PHP-5.6:
Implement RFC https://wiki.php.net/rfc/default_encoding
34 files changed, 464 insertions, 161 deletions
diff --git a/ext/iconv/iconv.c b/ext/iconv/iconv.c index ea6ac1a1f1..87ad5eeaab 100644 --- a/ext/iconv/iconv.c +++ b/ext/iconv/iconv.c @@ -220,21 +220,55 @@ static char _generic_superset_name[] = ICONV_UCS4_ENCODING; #define GENERIC_SUPERSET_NBYTES 4 /* }}} */ -static PHP_INI_MH(OnUpdateStringIconvCharset) + +static PHP_INI_MH(OnUpdateInputEncoding) +{ + if (new_value_length >= ICONV_CSNMAXLEN) { + return FAILURE; + } + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, PG(input_encoding), strlen(PG(input_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} + + +static PHP_INI_MH(OnUpdateOutputEncoding) { if(new_value_length >= ICONV_CSNMAXLEN) { return FAILURE; } - OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, PG(output_encoding), strlen(PG(output_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } return SUCCESS; } + +static PHP_INI_MH(OnUpdateInternalEncoding) +{ + if(new_value_length >= ICONV_CSNMAXLEN) { + return FAILURE; + } + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, PG(internal_encoding), strlen(PG(internal_encoding))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} + + /* {{{ PHP_INI */ PHP_INI_BEGIN() - STD_PHP_INI_ENTRY("iconv.input_encoding", ICONV_INPUT_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, input_encoding, zend_iconv_globals, iconv_globals) - STD_PHP_INI_ENTRY("iconv.output_encoding", ICONV_OUTPUT_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, output_encoding, zend_iconv_globals, iconv_globals) - STD_PHP_INI_ENTRY("iconv.internal_encoding", ICONV_INTERNAL_ENCODING, PHP_INI_ALL, OnUpdateStringIconvCharset, internal_encoding, zend_iconv_globals, iconv_globals) + STD_PHP_INI_ENTRY("iconv.input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, zend_iconv_globals, iconv_globals) + STD_PHP_INI_ENTRY("iconv.output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, zend_iconv_globals, iconv_globals) + STD_PHP_INI_ENTRY("iconv.internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, zend_iconv_globals, iconv_globals) PHP_INI_END() /* }}} */ diff --git a/ext/iconv/php_iconv.h b/ext/iconv/php_iconv.h index 26e3f3b2a6..1389d7a993 100644 --- a/ext/iconv/php_iconv.h +++ b/ext/iconv/php_iconv.h @@ -79,15 +79,9 @@ ZEND_END_MODULE_GLOBALS(iconv) #endif #ifdef HAVE_IBM_ICONV -# define ICONV_INPUT_ENCODING "ISO8859-1" -# define ICONV_OUTPUT_ENCODING "ISO8859-1" -# define ICONV_INTERNAL_ENCODING "ISO8859-1" # define ICONV_ASCII_ENCODING "IBM-850" # define ICONV_UCS4_ENCODING "UCS-4" #else -# define ICONV_INPUT_ENCODING "ISO-8859-1" -# define ICONV_OUTPUT_ENCODING "ISO-8859-1" -# define ICONV_INTERNAL_ENCODING "ISO-8859-1" # define ICONV_ASCII_ENCODING "ASCII" # define ICONV_UCS4_ENCODING "UCS-4LE" #endif diff --git a/ext/iconv/tests/iconv_ini_encoding.phpt b/ext/iconv/tests/iconv_ini_encoding.phpt new file mode 100644 index 0000000000..b9a69824e1 --- /dev/null +++ b/ext/iconv/tests/iconv_ini_encoding.phpt @@ -0,0 +1,68 @@ +--TEST-- +Encoding INI test +--SKIPIF-- +<?php extension_loaded('iconv') or die('skip mbstring not available'); ?> +--INI-- +default_charset=ISO-8859-1 +internal_encoding= +input_encoding= +output_encoding= +iconv.internal_encoding=ISO-8859-1 +iconv.http_input=ISO-8859-1 +iconv.http_output=ISO-8859-1 +--FILE-- +<?php +echo "Getting INI\n"; +var_dump(ini_get('default_charset')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('output_encoding')); + +var_dump(ini_get('iconv.internal_encoding')); +var_dump(ini_get('iconv.input_encoding')); +var_dump(ini_get('iconv.output_encoding')); + +echo "Setting INI\n"; +var_dump(ini_set('default_charset', 'UTF-8')); +var_dump(ini_set('internal_encoding', 'UTF-8')); +var_dump(ini_set('input_encoding', 'UTF-8')); +var_dump(ini_set('output_encoding', 'UTF-8')); +var_dump(ini_set('iconv.internal_encoding', 'UTF-8')); +var_dump(ini_set('iconv.input_encoding', 'UTF-8')); +var_dump(ini_set('iconv.output_encoding', 'UTF-8')); + +echo "Getting INI\n"; +var_dump(ini_get('default_charset')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('output_encoding')); + +var_dump(ini_get('iconv.internal_encoding')); +var_dump(ini_get('iconv.input_encoding')); +var_dump(ini_get('iconv.output_encoding')); + +--EXPECT-- +Getting INI +string(10) "ISO-8859-1" +string(0) "" +string(0) "" +string(0) "" +string(10) "ISO-8859-1" +string(0) "" +string(0) "" +Setting INI +string(10) "ISO-8859-1" +string(0) "" +string(0) "" +string(0) "" +string(10) "ISO-8859-1" +string(0) "" +string(0) "" +Getting INI +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" diff --git a/ext/iconv/tests/iconv_set_encoding_variation.phpt b/ext/iconv/tests/iconv_set_encoding_variation.phpt index 311a9f93f2..e239c6c18b 100644 --- a/ext/iconv/tests/iconv_set_encoding_variation.phpt +++ b/ext/iconv/tests/iconv_set_encoding_variation.phpt @@ -183,17 +183,17 @@ string(3) "0.5" bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 11 -- bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 12 -- bool(true) @@ -207,9 +207,9 @@ string(1) "1" bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 14 -- bool(true) @@ -223,25 +223,25 @@ string(1) "1" bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 16 -- bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 17 -- bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 18 -- bool(true) @@ -279,17 +279,17 @@ string(5) "UTF-8" bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 23 -- bool(true) bool(true) bool(true) -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" -- Iteration 24 -- @@ -301,7 +301,7 @@ NULL Warning: iconv_set_encoding() expects parameter 2 to be string, resource given in %s on line %d NULL -string(0) "" -string(0) "" -string(0) "" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" Done
\ No newline at end of file diff --git a/ext/mbstring/mbstring.c b/ext/mbstring/mbstring.c index a3adbc357b..1ae43602d1 100644 --- a/ext/mbstring/mbstring.c +++ b/ext/mbstring/mbstring.c @@ -1236,6 +1236,11 @@ static PHP_INI_MH(OnUpdate_mbstring_http_input) if (MBSTRG(http_input_list)) { pefree(MBSTRG(http_input_list), 1); } + if (SUCCESS == php_mb_parse_encoding_list(PG(input_encoding), strlen(PG(input_encoding))+1, &list, &size, 1 TSRMLS_CC)) { + MBSTRG(http_input_list) = list; + MBSTRG(http_input_list_size) = 0; + return SUCCESS; + } MBSTRG(http_input_list) = NULL; MBSTRG(http_input_list_size) = 0; return SUCCESS; @@ -1261,18 +1266,20 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output) const mbfl_encoding *encoding; if (new_value == NULL || new_value_length == 0) { - MBSTRG(http_output_encoding) = &mbfl_encoding_pass; - MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass; - return SUCCESS; - } - - encoding = mbfl_name2encoding(new_value); - if (!encoding) { - MBSTRG(http_output_encoding) = &mbfl_encoding_pass; - MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass; - return FAILURE; + encoding = mbfl_name2encoding(PG(output_encoding)); + if (!encoding) { + MBSTRG(http_output_encoding) = &mbfl_encoding_pass; + MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass; + return SUCCESS; + } + } else { + encoding = mbfl_name2encoding(new_value); + if (!encoding) { + MBSTRG(http_output_encoding) = &mbfl_encoding_pass; + MBSTRG(current_http_output_encoding) = &mbfl_encoding_pass; + return FAILURE; + } } - MBSTRG(http_output_encoding) = encoding; MBSTRG(current_http_output_encoding) = encoding; return SUCCESS; @@ -1285,47 +1292,17 @@ int _php_mb_ini_mbstring_internal_encoding_set(const char *new_value, uint new_v const mbfl_encoding *encoding; if (!new_value || new_value_length == 0 || !(encoding = mbfl_name2encoding(new_value))) { - switch (MBSTRG(language)) { - case mbfl_no_language_uni: - encoding = mbfl_no2encoding(mbfl_no_encoding_utf8); - break; - case mbfl_no_language_japanese: - encoding = mbfl_no2encoding(mbfl_no_encoding_euc_jp); - break; - case mbfl_no_language_korean: - encoding = mbfl_no2encoding(mbfl_no_encoding_euc_kr); - break; - case mbfl_no_language_simplified_chinese: - encoding = mbfl_no2encoding(mbfl_no_encoding_euc_cn); - break; - case mbfl_no_language_traditional_chinese: - encoding = mbfl_no2encoding(mbfl_no_encoding_euc_tw); - break; - case mbfl_no_language_russian: - encoding = mbfl_no2encoding(mbfl_no_encoding_koi8r); - break; - case mbfl_no_language_german: - encoding = mbfl_no2encoding(mbfl_no_encoding_8859_15); - break; - case mbfl_no_language_armenian: - encoding = mbfl_no2encoding(mbfl_no_encoding_armscii8); - break; - case mbfl_no_language_turkish: - encoding = mbfl_no2encoding(mbfl_no_encoding_8859_9); - break; - default: - encoding = mbfl_no2encoding(mbfl_no_encoding_8859_1); - break; - } - } + /* falls back to UTF-8 if an unkown encoding name is given */ + encoding = mbfl_no2encoding(mbfl_no_encoding_utf8); + } MBSTRG(internal_encoding) = encoding; MBSTRG(current_internal_encoding) = encoding; #if HAVE_MBREGEX { const char *enc_name = new_value; if (FAILURE == php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC)) { - /* falls back to EUC-JP if an unknown encoding name is given */ - enc_name = "EUC-JP"; + /* falls back to UTF-8 if an unknown encoding name is given */ + enc_name = "UTF-8"; php_mb_regex_set_default_mbctype(enc_name TSRMLS_CC); } php_mb_regex_set_mbctype(new_value TSRMLS_CC); @@ -1343,7 +1320,11 @@ static PHP_INI_MH(OnUpdate_mbstring_internal_encoding) } if (stage == PHP_INI_STAGE_STARTUP || stage == PHP_INI_STAGE_SHUTDOWN || stage == PHP_INI_STAGE_RUNTIME) { - return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC); + if (new_value_length) { + return _php_mb_ini_mbstring_internal_encoding_set(new_value, new_value_length TSRMLS_CC); + } else { + return _php_mb_ini_mbstring_internal_encoding_set(PG(internal_encoding), strlen(PG(internal_encoding))+1 TSRMLS_CC); + } } else { /* the corresponding mbstring globals needs to be set according to the * ini value in the later stage because it never falls back to the @@ -1450,8 +1431,8 @@ static PHP_INI_MH(OnUpdate_mbstring_http_output_conv_mimetypes) PHP_INI_BEGIN() PHP_INI_ENTRY("mbstring.language", "neutral", PHP_INI_ALL, OnUpdate_mbstring_language) PHP_INI_ENTRY("mbstring.detect_order", NULL, PHP_INI_ALL, OnUpdate_mbstring_detect_order) - PHP_INI_ENTRY("mbstring.http_input", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_input) - PHP_INI_ENTRY("mbstring.http_output", "pass", PHP_INI_ALL, OnUpdate_mbstring_http_output) + PHP_INI_ENTRY("mbstring.http_input", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_input) + PHP_INI_ENTRY("mbstring.http_output", NULL, PHP_INI_ALL, OnUpdate_mbstring_http_output) STD_PHP_INI_ENTRY("mbstring.internal_encoding", NULL, PHP_INI_ALL, OnUpdate_mbstring_internal_encoding, internal_encoding_name, zend_mbstring_globals, mbstring_globals) PHP_INI_ENTRY("mbstring.substitute_character", NULL, PHP_INI_ALL, OnUpdate_mbstring_substitute_character) STD_PHP_INI_ENTRY("mbstring.func_overload", "0", @@ -2162,8 +2143,10 @@ PHP_FUNCTION(mb_output_handler) /* feed the string */ mbfl_string_init(&string); - string.no_language = MBSTRG(language); - string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + /* these are not needed. convd has encoding info. + string.no_language = MBSTRG(language); + string.no_encoding = MBSTRG(current_internal_encoding)->no_encoding; + */ string.val = (unsigned char *)arg_string; string.len = arg_string_len; mbfl_buffer_converter_feed(MBSTRG(outconv), &string); diff --git a/ext/mbstring/tests/ini_encoding.phpt b/ext/mbstring/tests/ini_encoding.phpt new file mode 100644 index 0000000000..79a0f3aad4 --- /dev/null +++ b/ext/mbstring/tests/ini_encoding.phpt @@ -0,0 +1,73 @@ +--TEST-- +Encoding INI test +--SKIPIF-- +<?php extension_loaded('mbstring') or die('skip mbstring not available'); ?> +--INI-- +default_charset=Shift_JIS +internal_encoding= +input_encoding= +output_encoding= +mbstring.internal_encoding=Shift_JIS +mbstring.http_input=Shift_JIS +mbstring.http_output=Shift_JIS +--FILE-- +<?php +echo "Getting INI\n"; +var_dump(ini_get('default_charset')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('output_encoding')); + +var_dump(ini_get('mbstring.internal_encoding')); +var_dump(mb_internal_encoding()); +var_dump(ini_get('mbstring.http_input')); +var_dump(ini_get('mbstring.http_output')); + +echo "Setting INI\n"; +var_dump(ini_set('default_charset', 'UTF-8')); +var_dump(ini_set('internal_encoding', 'UTF-8')); +var_dump(ini_set('input_encoding', 'UTF-8')); +var_dump(ini_set('output_encoding', 'UTF-8')); +var_dump(ini_set('mbstring.internal_encoding', 'UTF-8')); +var_dump(ini_set('mbstring.http_input', 'UTF-8')); +var_dump(ini_set('mbstring.http_output', 'UTF-8')); + +echo "Getting INI\n"; +var_dump(ini_get('default_charset')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('output_encoding')); + +var_dump(ini_get('mbstring.internal_encoding')); +var_dump(mb_internal_encoding()); +var_dump(ini_get('mbstring.http_input')); +var_dump(ini_get('mbstring.http_output')); + + +--EXPECT-- +Getting INI +string(9) "Shift_JIS" +string(0) "" +string(0) "" +string(0) "" +string(9) "Shift_JIS" +string(4) "SJIS" +string(9) "Shift_JIS" +string(9) "Shift_JIS" +Setting INI +string(9) "Shift_JIS" +string(0) "" +string(0) "" +string(0) "" +string(9) "Shift_JIS" +string(9) "Shift_JIS" +string(9) "Shift_JIS" +Getting INI +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" +string(5) "UTF-8" diff --git a/ext/standard/html.c b/ext/standard/html.c index 91fc050add..075a4d2ff9 100644 --- a/ext/standard/html.c +++ b/ext/standard/html.c @@ -1432,8 +1432,8 @@ encode_amp: */ static void php_html_entities(INTERNAL_FUNCTION_PARAMETERS, int all) { - char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; + char *str, *hint_charset = PHP_DEFAULT_CHARSET; + int str_len, hint_charset_len = sizeof(PHP_DEFAULT_CHARSET)-1; size_t new_len; long flags = ENT_COMPAT; char *replaced; @@ -1504,8 +1504,8 @@ PHP_FUNCTION(htmlspecialchars_decode) Convert all HTML entities to their applicable characters */ PHP_FUNCTION(html_entity_decode) { - char *str, *hint_charset = NULL; - int str_len, hint_charset_len = 0; + char *str, *hint_charset = PHP_DEFAULT_CHARSET; + int str_len, hint_charset_len = sizeof(PHP_DEFAULT_CHARSET)-1; size_t new_len = 0; long quote_style = ENT_COMPAT; char *replaced; diff --git a/main/SAPI.h b/main/SAPI.h index 71942f5663..ecb1743820 100644 --- a/main/SAPI.h +++ b/main/SAPI.h @@ -21,6 +21,7 @@ #ifndef SAPI_H #define SAPI_H +#include "php.h" #include "zend.h" #include "zend_API.h" #include "zend_llist.h" @@ -291,7 +292,7 @@ struct _sapi_post_entry { #define SAPI_HEADER_SEND_FAILED 3 #define SAPI_DEFAULT_MIMETYPE "text/html" -#define SAPI_DEFAULT_CHARSET "" +#define SAPI_DEFAULT_CHARSET PHP_DEFAULT_CHARSET #define SAPI_PHP_VERSION_HEADER "X-Powered-By: PHP/" PHP_VERSION #define SAPI_POST_READER_FUNC(post_reader) void post_reader(TSRMLS_D) diff --git a/main/main.c b/main/main.c index ebb158ac7c..8bb7903187 100644 --- a/main/main.c +++ b/main/main.c @@ -417,6 +417,45 @@ static PHP_INI_DISP(display_errors_mode) /* {{{ PHP_INI_MH */ +static PHP_INI_MH(OnUpdateInternalEncoding) +{ + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ +static PHP_INI_MH(OnUpdateInputEncoding) +{ + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ +static PHP_INI_MH(OnUpdateOutputEncoding) +{ + if (new_value_length) { + OnUpdateString(entry, new_value, new_value_length, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } else { + OnUpdateString(entry, SG(default_charset), strlen(SG(default_charset))+1, mh_arg1, mh_arg2, mh_arg3, stage TSRMLS_CC); + } + return SUCCESS; +} +/* }}} */ + +/* {{{ PHP_INI_MH + */ static PHP_INI_MH(OnUpdateErrorLog) { /* Only do the safemode/open_basedir check at runtime */ @@ -522,8 +561,11 @@ PHP_INI_BEGIN() STD_PHP_INI_ENTRY("auto_append_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_append_file, php_core_globals, core_globals) STD_PHP_INI_ENTRY("auto_prepend_file", NULL, PHP_INI_SYSTEM|PHP_INI_PERDIR, OnUpdateString, auto_prepend_file, php_core_globals, core_globals) STD_PHP_INI_ENTRY("doc_root", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, doc_root, php_core_globals, core_globals) - STD_PHP_INI_ENTRY("default_charset", SAPI_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct,sapi_globals) - STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct,sapi_globals) + STD_PHP_INI_ENTRY("default_charset", PHP_DEFAULT_CHARSET, PHP_INI_ALL, OnUpdateString, default_charset, sapi_globals_struct, sapi_globals) + STD_PHP_INI_ENTRY("default_mimetype", SAPI_DEFAULT_MIMETYPE, PHP_INI_ALL, OnUpdateString, default_mimetype, sapi_globals_struct, sapi_globals) + STD_PHP_INI_ENTRY("internal_encoding", "", PHP_INI_ALL, OnUpdateInternalEncoding, internal_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("input_encoding", "", PHP_INI_ALL, OnUpdateInputEncoding, input_encoding, php_core_globals, core_globals) + STD_PHP_INI_ENTRY("output_encoding", "", PHP_INI_ALL, OnUpdateOutputEncoding, output_encoding, php_core_globals, core_globals) STD_PHP_INI_ENTRY("error_log", NULL, PHP_INI_ALL, OnUpdateErrorLog, error_log, php_core_globals, core_globals) STD_PHP_INI_ENTRY("extension_dir", PHP_EXTENSION_DIR, PHP_INI_SYSTEM, OnUpdateStringUnempty, extension_dir, php_core_globals, core_globals) STD_PHP_INI_ENTRY("sys_temp_dir", NULL, PHP_INI_SYSTEM, OnUpdateStringUnempty, sys_temp_dir, php_core_globals, core_globals) diff --git a/main/php.h b/main/php.h index c2d0d936ca..f9cfd2d7f2 100644 --- a/main/php.h +++ b/main/php.h @@ -29,6 +29,7 @@ #define PHP_API_VERSION 20131218 #define PHP_HAVE_STREAMS #define YYDEBUG 0 +#define PHP_DEFAULT_CHARSET "UTF-8" #include "php_version.h" #include "zend.h" diff --git a/main/php_globals.h b/main/php_globals.h index b8f64d6d31..d8ba6142d4 100644 --- a/main/php_globals.h +++ b/main/php_globals.h @@ -96,6 +96,10 @@ struct _php_core_globals { char *auto_prepend_file; char *auto_append_file; + char *input_encoding; + char *internal_encoding; + char *output_encoding; + arg_separators arg_separator; char *variables_order; diff --git a/php.ini-development b/php.ini-development index 137574bdee..ed4ddd5f83 100644 --- a/php.ini-development +++ b/php.ini-development @@ -678,9 +678,26 @@ auto_append_file = ; http://php.net/default-mimetype default_mimetype = "text/html" -; PHP's default character set is set to empty. +; PHP's default character set is set to UTF-8 ; http://php.net/default-charset -;default_charset = "UTF-8" +default_charset = "UTF-8" + +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; If empty, default_charset is used. +; mbstring or iconv output handler is used. +; See also output_buffer. +; http://php.net/output-encoding +;output_encoding = ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; @@ -925,9 +942,17 @@ cli_server.color = On ;filter.default_flags = [iconv] -;iconv.input_encoding = ISO-8859-1 -;iconv.internal_encoding = ISO-8859-1 -;iconv.output_encoding = ISO-8859-1 +; Use of this INI entory is deprecated, use global input_encoding instead. +; If empty, input_encoding is used. +;iconv.input_encoding = + +; Use of this INI entory is deprecated, use global internal_encoding instead. +; If empty, internal_encoding is used. +;iconv.internal_encoding = + +; Use of this INI entory is deprecated, use global output_encoding instead. +; If empty, output_encoding is used. +;iconv.output_encoding = [intl] ;intl.default_locale = @@ -1690,23 +1715,30 @@ mssql.secure_connection = Off [mbstring] ; language for internal character representation. +; This affects mb_send_mail() and mbstrig.detect_order. ; http://php.net/mbstring.language ;mbstring.language = Japanese +; Use of this INI entory is deprecated, use global internal_encoding instead. ; internal/script encoding. -; Some encoding cannot work as internal encoding. -; (e.g. SJIS, BIG5, ISO-2022-*) +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding is used in order. ; http://php.net/mbstring.internal-encoding -;mbstring.internal_encoding = UTF-8 +;mbstring.internal_encoding = +; Use of this INI entory is deprecated, use global input_encoding instead. ; http input encoding. +; If empty, input_encoding is used. +; mbstring.encoding_traslation = On is needed to use this setting. ; http://php.net/mbstring.http-input -;mbstring.http_input = UTF-8 +;mbstring.http_input = -; http output encoding. mb_output_handler must be -; registered as output buffer to function +; Use of this INI entory is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, output_encoding is used. ; http://php.net/mbstring.http-output -;mbstring.http_output = pass +;mbstring.http_output = ; enable automatic encoding translation according to ; mbstring.internal_encoding setting. Input chars are @@ -1717,7 +1749,7 @@ mssql.secure_connection = Off ;mbstring.encoding_translation = Off ; automatic encoding detection order. -; auto means +; "auto" detect order is changed accoding to mbstring.language ; http://php.net/mbstring.detect-order ;mbstring.detect_order = auto @@ -1738,6 +1770,7 @@ mssql.secure_connection = Off ;mbstring.func_overload = 0 ; enable strict encoding detection. +; Default: Off ;mbstring.strict_detection = On ; This directive specifies the regex pattern of content types for which mb_output_handler() diff --git a/php.ini-production b/php.ini-production index 3fa1788a00..4a8f0e4e77 100644 --- a/php.ini-production +++ b/php.ini-production @@ -680,7 +680,22 @@ default_mimetype = "text/html" ; PHP's default character set is set to empty. ; http://php.net/default-charset -;default_charset = "UTF-8" +default_charset = "UTF-8" + +; PHP internal character encoding is set to empty. +; If empty, default_charset is used. +; http://php.net/internal-encoding +;internal_encoding = + +; PHP input character encoding is set to empty. +; http://php.net/input-encoding +;input_encoding = + +; PHP output character encoding is set to empty. +; mbstring or iconv output handler is used. +; See also output_buffer. +; http://php.net/output-encoding +;output_encoding = ;;;;;;;;;;;;;;;;;;;;;;;;; ; Paths and Directories ; @@ -925,9 +940,17 @@ cli_server.color = On ;filter.default_flags = [iconv] -;iconv.input_encoding = ISO-8859-1 -;iconv.internal_encoding = ISO-8859-1 -;iconv.output_encoding = ISO-8859-1 +; Use of this INI entory is deprecated, use global input_encoding instead. +; If empty, input_encoding is used. +;iconv.input_encoding = + +; Use of this INI entory is deprecated, use global internal_encoding instead. +; If empty, internal_encoding is used. +;iconv.internal_encoding = + +; Use of this INI entory is deprecated, use global output_encoding instead. +; If empty, output_encoding is used. +;iconv.output_encoding = [intl] ;intl.default_locale = @@ -1690,23 +1713,30 @@ mssql.secure_connection = Off [mbstring] ; language for internal character representation. +; This affects mb_send_mail() and mbstrig.detect_order. ; http://php.net/mbstring.language ;mbstring.language = Japanese +; Use of this INI entory is deprecated, use global internal_encoding instead. ; internal/script encoding. -; Some encoding cannot work as internal encoding. -; (e.g. SJIS, BIG5, ISO-2022-*) +; Some encoding cannot work as internal encoding. (e.g. SJIS, BIG5, ISO-2022-*) +; If empty, default_charset or internal_encoding is used in order. ; http://php.net/mbstring.internal-encoding -;mbstring.internal_encoding = UTF-8 +;mbstring.internal_encoding = +; Use of this INI entory is deprecated, use global input_encoding instead. ; http input encoding. +; If empty, input_encoding is used. +; mbstring.encoding_traslation = On is needed to use this setting. ; http://php.net/mbstring.http-input -;mbstring.http_input = UTF-8 +;mbstring.http_input = -; http output encoding. mb_output_handler must be -; registered as output buffer to function +; Use of this INI entory is deprecated, use global output_encoding instead. +; http output encoding. +; mb_output_handler must be registered as output buffer to function. +; If empty, output_encoding is used. ; http://php.net/mbstring.http-output -;mbstring.http_output = pass +;mbstring.http_output = ; enable automatic encoding translation according to ; mbstring.internal_encoding setting. Input chars are @@ -1717,7 +1747,7 @@ mssql.secure_connection = Off ;mbstring.encoding_translation = Off ; automatic encoding detection order. -; auto means +; "auto" detect order is changed accoding to mbstring.language ; http://php.net/mbstring.detect-order ;mbstring.detect_order = auto @@ -1738,6 +1768,7 @@ mssql.secure_connection = Off ;mbstring.func_overload = 0 ; enable strict encoding detection. +; Default: Off ;mbstring.strict_detection = On ; This directive specifies the regex pattern of content types for which mb_output_handler() diff --git a/sapi/cgi/tests/010.phpt b/sapi/cgi/tests/010.phpt index e633ad28ba..67e1a69e26 100644 --- a/sapi/cgi/tests/010.phpt +++ b/sapi/cgi/tests/010.phpt @@ -40,14 +40,14 @@ echo "Done\n"; --EXPECTF-- Status: 403 Forbidden X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 Status: 403 Forbidden X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 X-Powered-By: PHP/%s Status: 403 Also Forbidden -Content-type: text/html +Content-type: text/html; charset=UTF-8 Done diff --git a/sapi/cgi/tests/011.phpt b/sapi/cgi/tests/011.phpt index 177df021a6..6d4a6ed7f9 100644 --- a/sapi/cgi/tests/011.phpt +++ b/sapi/cgi/tests/011.phpt @@ -65,18 +65,18 @@ header_remove("X-Foo"); <?php ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php header_remove(); ?> ---------- -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php header_remove("X-Foo"); ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -85,7 +85,7 @@ header("X-Foo: Bar"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -96,7 +96,7 @@ header_remove("X-Foo"); ---------- X-Powered-By: PHP/%s X-Bar: Baz -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -106,7 +106,7 @@ header_remove("X-Foo: Bar"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 Warning: Header to delete may not contain colon. in %s on line 3 @@ -118,7 +118,7 @@ header_remove("X-Foo:"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 Warning: Header to delete may not contain colon. in %s on line 3 @@ -128,7 +128,7 @@ header("X-Foo: Bar"); header_remove(); ?> ---------- -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -136,7 +136,7 @@ header_remove(""); ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 ---------- <?php @@ -144,7 +144,7 @@ header_remove(":"); ?> ---------- X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 Warning: Header to delete may not contain colon. in %s on line 2 @@ -158,7 +158,7 @@ header_remove("X-Foo"); ---------- X-Powered-By: PHP/%s X-Foo: Bar -Content-type: text/html +Content-type: text/html; charset=UTF-8 flush diff --git a/sapi/cli/tests/bug43177.phpt b/sapi/cli/tests/bug43177.phpt index 36b5504ab0..a97769cf8f 100644 --- a/sapi/cli/tests/bug43177.phpt +++ b/sapi/cli/tests/bug43177.phpt @@ -60,23 +60,23 @@ HTTP/1.1 200 OK Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 OK HTTP/1.0 500 Internal Server Error Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 HTTP/1.0 500 Internal Server Error Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 HTTP/1.0 500 Internal Server Error Host: localhost Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65066_100.phpt b/sapi/cli/tests/bug65066_100.phpt index 3a97c7e910..901ba188fd 100644 --- a/sapi/cli/tests/bug65066_100.phpt +++ b/sapi/cli/tests/bug65066_100.phpt @@ -36,4 +36,4 @@ HTTP/1.1 100 Continue Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65066_422.phpt b/sapi/cli/tests/bug65066_422.phpt index 2552d1d11d..4e5d31c7a7 100644 --- a/sapi/cli/tests/bug65066_422.phpt +++ b/sapi/cli/tests/bug65066_422.phpt @@ -36,4 +36,4 @@ HTTP/1.1 422 Unknown Status Code Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65066_511.phpt b/sapi/cli/tests/bug65066_511.phpt index aa4a9a0030..a0b4eae393 100644 --- a/sapi/cli/tests/bug65066_511.phpt +++ b/sapi/cli/tests/bug65066_511.phpt @@ -36,4 +36,4 @@ HTTP/1.1 511 Network Authentication Required Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/bug65633.phpt b/sapi/cli/tests/bug65633.phpt index 55834095b1..456436b1f7 100644 --- a/sapi/cli/tests/bug65633.phpt +++ b/sapi/cli/tests/bug65633.phpt @@ -39,7 +39,7 @@ fclose($fp); HTTP/1.1 200 OK Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(1) { ["foo"]=> diff --git a/sapi/cli/tests/php_cli_server_004.phpt b/sapi/cli/tests/php_cli_server_004.phpt index b61f88637e..8b913f6596 100644 --- a/sapi/cli/tests/php_cli_server_004.phpt +++ b/sapi/cli/tests/php_cli_server_004.phpt @@ -40,7 +40,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(19) "HTTP_HOST:localhost" string(21) "HTTP_USER_AGENT:dummy" diff --git a/sapi/cli/tests/php_cli_server_005.phpt b/sapi/cli/tests/php_cli_server_005.phpt index ccc0f8f3ab..cdd0ae902f 100644 --- a/sapi/cli/tests/php_cli_server_005.phpt +++ b/sapi/cli/tests/php_cli_server_005.phpt @@ -52,7 +52,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(1) { ["userfile"]=> diff --git a/sapi/cli/tests/php_cli_server_006.phpt b/sapi/cli/tests/php_cli_server_006.phpt index 09e7ab07a5..ad6d6c9598 100644 --- a/sapi/cli/tests/php_cli_server_006.phpt +++ b/sapi/cli/tests/php_cli_server_006.phpt @@ -36,7 +36,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(3) "foo" string(3) "bar" diff --git a/sapi/cli/tests/php_cli_server_007.phpt b/sapi/cli/tests/php_cli_server_007.phpt index 64d4df0ed7..6420ff5a41 100644 --- a/sapi/cli/tests/php_cli_server_007.phpt +++ b/sapi/cli/tests/php_cli_server_007.phpt @@ -37,4 +37,4 @@ Host: %s Connection: close X-Powered-By: PHP/%s WWW-Authenticate: Digest realm="foo",qop="auth",nonce="XXXXX",opaque="acbd18db4cc2f85cedef654fccc4a4d8" -Content-type: text/html +Content-type: text/html; charset=UTF-8 diff --git a/sapi/cli/tests/php_cli_server_008.phpt b/sapi/cli/tests/php_cli_server_008.phpt index 2e68e24059..01f825a746 100644 --- a/sapi/cli/tests/php_cli_server_008.phpt +++ b/sapi/cli/tests/php_cli_server_008.phpt @@ -56,13 +56,13 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(8) "HTTP/1.1" HTTP/1.0 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(8) "HTTP/1.0" diff --git a/sapi/cli/tests/php_cli_server_009.phpt b/sapi/cli/tests/php_cli_server_009.phpt index 2beaeedab6..231797160f 100644 --- a/sapi/cli/tests/php_cli_server_009.phpt +++ b/sapi/cli/tests/php_cli_server_009.phpt @@ -80,14 +80,14 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(8) "/foo/bar" HTTP/1.0 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(9) "/foo/bar/" HTTP/1.0 404 Not Found diff --git a/sapi/cli/tests/php_cli_server_010.phpt b/sapi/cli/tests/php_cli_server_010.phpt index 2ef018b857..30e6d047a7 100644 --- a/sapi/cli/tests/php_cli_server_010.phpt +++ b/sapi/cli/tests/php_cli_server_010.phpt @@ -57,7 +57,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(18) "/index.php/foo/bar" string(10) "/index.php" @@ -67,7 +67,7 @@ HTTP/1.0 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(19) "/index.php/foo/bar/" string(10) "/index.php" diff --git a/sapi/cli/tests/php_cli_server_012.phpt b/sapi/cli/tests/php_cli_server_012.phpt index 9a1e60c48b..302540f7e6 100644 --- a/sapi/cli/tests/php_cli_server_012.phpt +++ b/sapi/cli/tests/php_cli_server_012.phpt @@ -42,7 +42,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 Array ( diff --git a/sapi/cli/tests/php_cli_server_015.phpt b/sapi/cli/tests/php_cli_server_015.phpt index 6fb0169244..e3d8c4170d 100644 --- a/sapi/cli/tests/php_cli_server_015.phpt +++ b/sapi/cli/tests/php_cli_server_015.phpt @@ -43,7 +43,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 <br /> <b>Fatal error</b>: Call to undefined function non_exists_function() in <b>%ssyntax_error.php</b> on line <b>%s</b><br /> diff --git a/sapi/cli/tests/php_cli_server_017.phpt b/sapi/cli/tests/php_cli_server_017.phpt index 73530af480..34e7d5e289 100644 --- a/sapi/cli/tests/php_cli_server_017.phpt +++ b/sapi/cli/tests/php_cli_server_017.phpt @@ -39,6 +39,6 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(%d) "%sindex.php" diff --git a/sapi/cli/tests/php_cli_server_018.phpt b/sapi/cli/tests/php_cli_server_018.phpt index deb9348768..44e1292934 100644 --- a/sapi/cli/tests/php_cli_server_018.phpt +++ b/sapi/cli/tests/php_cli_server_018.phpt @@ -39,6 +39,6 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: %s -Content-type: text/html +Content-type: text/html; charset=UTF-8 string(5) "PATCH" diff --git a/sapi/cli/tests/php_cli_server_019.phpt b/sapi/cli/tests/php_cli_server_019.phpt index 2b983e5c0a..aeb7a9f891 100644 --- a/sapi/cli/tests/php_cli_server_019.phpt +++ b/sapi/cli/tests/php_cli_server_019.phpt @@ -44,7 +44,7 @@ Host: %s Connection: close X-Powered-By: %s Bar-Foo: Foo -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(2) { ["Host"]=> @@ -64,5 +64,5 @@ array(3) { ["Bar-Foo"]=> string(3) "Foo" ["Content-type"]=> - string(9) "text/html" + string(24) "text/html; charset=UTF-8" } diff --git a/sapi/cli/tests/upload_2G.phpt b/sapi/cli/tests/upload_2G.phpt index b8416ea730..707eddbad3 100644 --- a/sapi/cli/tests/upload_2G.phpt +++ b/sapi/cli/tests/upload_2G.phpt @@ -43,7 +43,7 @@ if (!$fp) { } $prev = "----123 -Content-Type: text/plain +Content-Type: text/plain; charset=UTF-8 Content-Disposition: form-data; name=\"file1\"; filename=\"file1.txt\"\n\n"; $post = "\n----123--\n"; $total = $length + strlen($prev) + strlen($post); @@ -79,7 +79,7 @@ HTTP/1.1 200 OK Host: %s Connection: close X-Powered-By: PHP/%s -Content-type: text/html +Content-type: text/html; charset=UTF-8 array(1) { ["file1"]=> diff --git a/tests/basic/encoding.phpt b/tests/basic/encoding.phpt new file mode 100644 index 0000000000..b2ee5f3ca2 --- /dev/null +++ b/tests/basic/encoding.phpt @@ -0,0 +1,39 @@ +--TEST-- +PHP encoding setting test +--INI-- +--FILE-- +<?php +var_dump(ini_get('default_charset')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('output_encoding')); + +var_dump(ini_set('default_charset', 'ISO-8859-1')); +var_dump(ini_get('default_charset')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('output_encoding')); + +var_dump(ini_set('input_encoding', 'ISO-8859-1')); +var_dump(ini_set('internal_encoding', 'ISO-8859-1')); +var_dump(ini_set('output_encoding', 'ISO-8859-1')); +var_dump(ini_get('input_encoding')); +var_dump(ini_get('internal_encoding')); +var_dump(ini_get('output_encoding')); + +--EXPECTF-- +string(5) "UTF-8" +string(0) "" +string(0) "" +string(0) "" +string(5) "UTF-8" +string(10) "ISO-8859-1" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(0) "" +string(10) "ISO-8859-1" +string(10) "ISO-8859-1" +string(10) "ISO-8859-1"
\ No newline at end of file |