summaryrefslogtreecommitdiffstats
path: root/system/core/Utf8.php
diff options
context:
space:
mode:
authorAndrey Andreev <narf@devilix.net>2014-02-20 16:51:41 +0100
committerAndrey Andreev <narf@devilix.net>2014-02-20 16:51:41 +0100
commitbb3edf12d0ca82c62f7b7d570108375ec4379749 (patch)
tree8be304b5b58b42698bfaf37e6dd19a451a19fa96 /system/core/Utf8.php
parent10e7a32257b26c5609f4a745e3f80bde00da3a05 (diff)
CI_Utf8-related changes
- Give priority to mb_convert_encoding() over iconv() in clean_string() (partially fixes #261) - Add more proper unit tests
Diffstat (limited to 'system/core/Utf8.php')
-rw-r--r--system/core/Utf8.php16
1 files changed, 8 insertions, 8 deletions
diff --git a/system/core/Utf8.php b/system/core/Utf8.php
index c789a7ba4..9a92efe68 100644
--- a/system/core/Utf8.php
+++ b/system/core/Utf8.php
@@ -80,13 +80,13 @@ class CI_Utf8 {
{
if ($this->is_ascii($str) === FALSE)
{
- if (ICONV_ENABLED)
+ if (MB_ENABLED)
{
- $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
+ $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8');
}
- elseif (MB_ENABLED)
+ elseif (ICONV_ENABLED)
{
- $str = mb_convert_encoding($str, 'UTF-8', 'UTF-8');
+ $str = @iconv('UTF-8', 'UTF-8//IGNORE', $str);
}
}
@@ -123,13 +123,13 @@ class CI_Utf8 {
*/
public function convert_to_utf8($str, $encoding)
{
- if (ICONV_ENABLED)
+ if (MB_ENABLED)
{
- return @iconv($encoding, 'UTF-8', $str);
+ return mb_convert_encoding($str, 'UTF-8', $encoding);
}
- elseif (MB_ENABLED === TRUE)
+ elseif (ICONV_ENABLED)
{
- return @mb_convert_encoding($str, 'UTF-8', $encoding);
+ return @iconv($encoding, 'UTF-8', $str);
}
return FALSE;