Util/Encoding

* set multibyte-encoding globally as suggested by @Toshik
This commit is contained in:
Sarjuuk
2015-09-19 15:27:20 +02:00
parent b1ef81c7e9
commit f33a15db4d
2 changed files with 8 additions and 6 deletions

View File

@@ -9,6 +9,8 @@ if (file_exists('config/config.php'))
else
$AoWoWconf = [];
mb_internal_encoding('UTF-8');
require_once 'includes/defines.php';
require_once 'includes/libs/DbSimple/Generic.php'; // Libraray: http://en.dklab.ru/lib/DbSimple (using variant: https://github.com/ivan1986/DbSimple/tree/master)
require_once 'includes/utilities.php'; // misc™ data 'n func

View File

@@ -1100,21 +1100,21 @@ class Util
// default ucFirst doesn't convert UTF-8 chars
public static function ucFirst($str)
{
$len = mb_strlen($str, 'UTF-8') - 1;
$first = mb_substr($str, 0, 1, 'UTF-8');
$rest = mb_substr($str, 1, $len, 'UTF-8');
$len = mb_strlen($str) - 1;
$first = mb_substr($str, 0, 1);
$rest = mb_substr($str, 1, $len);
return mb_strtoupper($first, 'UTF-8').$rest;
return mb_strtoupper($first).$rest;
}
public static function ucWords($str)
{
return mb_convert_case($str, MB_CASE_TITLE, 'UTF-8');
return mb_convert_case($str, MB_CASE_TITLE);
}
public static function lower($str)
{
return mb_strtolower($str, 'UTF-8');
return mb_strtolower($str);
}
// note: valid integer > 32bit are returned as float