From 51593f49cda71bdf8400ba6555a9e1598ff21c7c Mon Sep 17 00:00:00 2001 From: Andrey Andreev Date: Wed, 7 May 2014 00:06:31 +0300 Subject: Account for PHP 5.6 changes related to charsets --- system/core/CodeIgniter.php | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php index 9df042f02..a7118bfc7 100644 --- a/system/core/CodeIgniter.php +++ b/system/core/CodeIgniter.php @@ -204,11 +204,12 @@ if ( ! is_php('5.4')) * */ $charset = strtoupper(config_item('charset')); + ini_set('default_charset', $charset); if (extension_loaded('mbstring')) { define('MB_ENABLED', TRUE); - mb_internal_encoding($charset); + ini_set('mbstring.internal_encoding', $charset); // This is required for mb_convert_encoding() to strip invalid characters. // That's utilized by CI_Utf8, but it's also done for consistency with iconv. mb_substitute_character('none'); @@ -223,13 +224,20 @@ if ( ! is_php('5.4')) if (extension_loaded('iconv')) { define('ICONV_ENABLED', TRUE); - iconv_set_encoding('internal_encoding', $charset); + // iconv.internal_encoding is deprecated starting with PHP 5.6 + // and it's usage triggers E_DEPRECATED messages. + @ini_set('iconv.internal_encoding', $charset); } else { define('ICONV_ENABLED', FALSE); } + if (is_php('5.6')) + { + ini_set('php.internal_encoding', $charset); + } + /* * ------------------------------------------------------ * Load compatibility features -- cgit v1.2.3-24-g4f1b