forked from netcommons/NetCommons2
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmbstring.php
More file actions
42 lines (37 loc) · 975 Bytes
/
mbstring.php
File metadata and controls
42 lines (37 loc) · 975 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
<?php
include_once dirname(__FILE__).'/jcode_1.35a/jcode_wrapper.php';
function mb_convert_encoding($str, $to, $from = 'auto')
{
$str = jcode_convert_encoding($str, $to, $from);
return $str;
}
function mb_strlen($str)
{
return jstrlen(jcode_convert_encoding($str, "EUC-JP", _CHARSET));
}
function mb_substr($str, $start = 0, $length = NULL)
{
if (!isset($length)) {
$length = mb_strlen($str) - $start;
}
$rtn = jsubstr(jcode_convert_encoding($str, "EUC-JP", _CHARSET), $start, $length);
return jcode_convert_encoding($rtn, _CHARSET, "EUC-JP");
}
function mb_detect_encoding($str) {
$encode = AutoDetect($str);
if ($encode == 0) {
$encode = "ASCII";
} elseif ($encode == 1) {
$encode = "EUC-JP";
} elseif ($encode == 2) {
$encode = "SJIS";
} elseif ($encode == 3) {
$encode = "ISO-2022-JP";
} elseif ($encode == 4) {
$encode = "UTF-8";
} elseif ($encode == 5) {
$encode = "";
}
return $encode;
}
?>