summaryrefslogtreecommitdiffstats
path: root/system/core/Utf8.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@bofh.bg>2012-01-07 23:17:34 +0100
committerAndrey Andreev <narf@bofh.bg>2012-01-07 23:17:34 +0100
commitc123e118de32e2b31b9bf21fdb43458bc9f4cbda (patch)
tree7c030b297961fb33f11b616c9c47756be01ce88e /system/core/Utf8.php
parent9252d7bf2208d351aad4292cb79c509391f0313f (diff)
Improve core URI & UTF8 libraries
Diffstat (limited to 'system/core/Utf8.php')
-rw-r--r--system/core/Utf8.php32
1 files changed, 12 insertions, 20 deletions
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 40a7ac4c0..0e180d36f 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -1,13 +1,13 @@
-<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
+<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');
/**
* CodeIgniter
*
* An open source application development framework for PHP 5.1.6 or newer
*
* NOTICE OF LICENSE
- *
+ *
* Licensed under the Open Software License version 3.0
- *
+ *
* This source file is subject to the Open Software License (OSL 3.0) that is
* bundled with this package in the files license.txt / license.rst. It is
* also available through the world wide web at this URL:
@@ -47,20 +47,19 @@ class CI_Utf8 {
*/
public function __construct()
{
- log_message('debug', "Utf8 Class Initialized");
+ log_message('debug', 'Utf8 Class Initialized');
global $CFG;
if (
@preg_match('/./u', 'é') === 1 // PCRE must support UTF-8
&& function_exists('iconv') // iconv must be installed
- && ini_get('mbstring.func_overload') !== 1 // Multibyte string function overloading cannot be enabled
- && $CFG->item('charset') == 'UTF-8' // Application charset must be UTF-8
+ && @ini_get('mbstring.func_overload') != 1 // Multibyte string function overloading cannot be enabled
+ && $CFG->item('charset') === 'UTF-8' // Application charset must be UTF-8
)
{
- log_message('debug', "UTF-8 Support Enabled");
-
define('UTF8_ENABLED', TRUE);
+ log_message('debug', 'UTF-8 Support Enabled');
// set internal encoding for multibyte string functions if necessary
// and set a flag so we don't have to repeatedly use extension_loaded()
@@ -77,8 +76,8 @@ class CI_Utf8 {
}
else
{
- log_message('debug', "UTF-8 Support Disabled");
define('UTF8_ENABLED', FALSE);
+ log_message('debug', 'UTF-8 Support Disabled');
}
}
@@ -134,18 +133,14 @@ class CI_Utf8 {
{
if (function_exists('iconv'))
{
- $str = @iconv($encoding, 'UTF-8', $str);
+ return @iconv($encoding, 'UTF-8', $str);
}
elseif (function_exists('mb_convert_encoding'))
{
- $str = @mb_convert_encoding($str, 'UTF-8', $encoding);
- }
- else
- {
- return FALSE;
+ return @mb_convert_encoding($str, 'UTF-8', $encoding);
}
- return $str;
+ return FALSE;
}
// --------------------------------------------------------------------
@@ -163,10 +158,7 @@ class CI_Utf8 {
return (preg_match('/[^\x00-\x7F]/S', $str) === 0);
}
- // --------------------------------------------------------------------
-
}
-// End Utf8 Class
/* End of file Utf8.php */
-/* Location: ./system/core/Utf8.php */ \ No newline at end of file
+/* Location: ./system/core/Utf8.php */