Account for PHP 5.6 changes related to charsets
diff --git a/system/core/CodeIgniter.php b/system/core/CodeIgniter.php
index 9df042f..a7118bf 100644
--- a/system/core/CodeIgniter.php
+++ b/system/core/CodeIgniter.php
@@ -204,11 +204,12 @@
  *
  */
 	$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 (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