blob: 9dda43aec2a341eb67436e6badb1363b359890a3 [file] [log] [blame]
Taufan Aditya7756af52012-05-15 23:57:05 +07001<?php
2
3class Mock_Core_Utf8 extends CI_Utf8 {
Andrey Andreevf243ce12012-06-09 23:34:21 +03004
Taufan Aditya7756af52012-05-15 23:57:05 +07005 /**
Andrey Andreevf243ce12012-06-09 23:34:21 +03006 * We need to define several constants as
Taufan Aditya7756af52012-05-15 23:57:05 +07007 * the same process within CI_Utf8 class constructor.
8 *
9 * @covers CI_Utf8::__construct()
10 */
11 public function __construct()
12 {
Andrey Andreevf243ce12012-06-09 23:34:21 +030013 defined('UTF8_ENABLED') OR define('UTF8_ENABLED', TRUE);
Taufan Aditya7756af52012-05-15 23:57:05 +070014
15 if (extension_loaded('mbstring'))
16 {
Andrey Andreevf243ce12012-06-09 23:34:21 +030017 defined('MB_ENABLED') OR define('MB_ENABLED', TRUE);
Taufan Aditya7756af52012-05-15 23:57:05 +070018 mb_internal_encoding('UTF-8');
Andrey Andreevbe1496d2014-02-11 22:48:45 +020019 ini_set('mbstring.substitute_character', 'none');
Taufan Aditya7756af52012-05-15 23:57:05 +070020 }
21 else
22 {
Andrey Andreevf243ce12012-06-09 23:34:21 +030023 defined('MB_ENABLED') OR define('MB_ENABLED', FALSE);
Taufan Aditya7756af52012-05-15 23:57:05 +070024 }
Andrey Andreevbe1496d2014-02-11 22:48:45 +020025
26 if (extension_loaded('iconv'))
27 {
28 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', TRUE);
29 iconv_set_encoding('internal_encoding', 'UTF-8');
30 }
31 else
32 {
33 defined('ICONV_ENABLED') OR define('ICONV_ENABLED', FALSE);
34 }
Taufan Aditya7756af52012-05-15 23:57:05 +070035 }
36
Andrey Andreev291676b2014-01-16 18:39:52 +020037 public function is_ascii_test($str)
38 {
39 return $this->_is_ascii($str);
40 }
41
Taufan Aditya7756af52012-05-15 23:57:05 +070042}