summaryrefslogtreecommitdiffstats
path: root/system
diff options
context:
space:
mode:
authorPhil Sturgeon <email@philsturgeon.co.uk>2011-12-26 18:41:40 +0100
committerPhil Sturgeon <email@philsturgeon.co.uk>2011-12-26 18:41:40 +0100
commit1562d255b829f89364b63c2a0a47f4e06087bc48 (patch)
tree008d005de26bcb973121bafb7e0c9f01450696e7 /system
parent5f70687a8116830b0fe34c6a03a6cd7e963a8cdb (diff)
parentd2c4ec66946877ba4ef1c2bedf848eca9667c01d (diff)
Merge pull request #838 from EllisLab/feature/utf8-changes
Changes in the UTF8 Class.
Diffstat (limited to 'system')
-rw-r--r--system/core/Utf8.php25
1 files changed, 10 insertions, 15 deletions
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index 7abe4e43b..1bcf526a5 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -44,19 +44,18 @@ class CI_Utf8 {
* Constructor
*
* Determines if UTF-8 support is to be enabled
- *
*/
- function __construct()
+ public function __construct()
{
log_message('debug', "Utf8 Class Initialized");
global $CFG;
if (
- preg_match('/./u', 'é') === 1 // PCRE must support UTF-8
- AND function_exists('iconv') // iconv must be installed
- AND ini_get('mbstring.func_overload') != 1 // Multibyte string function overloading cannot be enabled
- AND $CFG->item('charset') == 'UTF-8' // Application charset must be UTF-8
+ @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
)
{
log_message('debug', "UTF-8 Support Enabled");
@@ -90,11 +89,10 @@ class CI_Utf8 {
*
* Ensures strings are UTF-8
*
- * @access public
* @param string
* @return string
*/
- function clean_string($str)
+ public function clean_string($str)
{
if ($this->_is_ascii($str) === FALSE)
{
@@ -113,11 +111,10 @@ class CI_Utf8 {
* line feeds, and carriage returns, as all others can cause
* problems in XML
*
- * @access public
* @param string
* @return string
*/
- function safe_ascii_for_xml($str)
+ public function safe_ascii_for_xml($str)
{
return remove_invisible_characters($str, FALSE);
}
@@ -129,12 +126,11 @@ class CI_Utf8 {
*
* Attempts to convert a string to UTF-8
*
- * @access public
* @param string
* @param string - input encoding
* @return string
*/
- function convert_to_utf8($str, $encoding)
+ public function convert_to_utf8($str, $encoding)
{
if (function_exists('iconv'))
{
@@ -159,13 +155,12 @@ class CI_Utf8 {
*
* Tests if a string is standard 7-bit ASCII or not
*
- * @access public
* @param string
* @return bool
*/
- function _is_ascii($str)
+ protected function _is_ascii($str)
{
- return (preg_match('/[^\x00-\x7F]/S', $str) == 0);
+ return (preg_match('/[^\x00-\x7F]/S', $str) === 0);
}
// --------------------------------------------------------------------