mirror of
https://github.com/Lastorder-DC/rhymix.git
synced 2026-04-28 14:52:24 +09:00
문자열을 검사하여 euc-kr이면 UTF-8로 변환하는 함수 추가
- detectUTF8() git-svn-id: http://xe-core.googlecode.com/svn/sandbox@7409 201d5d3c-b55e-5fd7-737f-ddc643e51545
This commit is contained in:
parent
5600ba63c1
commit
7f7a3a98c9
1 changed files with 14 additions and 0 deletions
|
|
@ -808,6 +808,20 @@
|
|||
}
|
||||
|
||||
|
||||
function detectUTF8($string, $return_convert = false, $urldecode = true) {
|
||||
if($urldecode) $string = urldecode($string);
|
||||
|
||||
$sample = iconv('utf-8', 'utf-8', $string);
|
||||
$is_utf8 = (md5($sample) == md5($string));
|
||||
|
||||
if(!$urldecode) $string = urldecode($string);
|
||||
|
||||
if($return_convert) return ($is_utf8) ? $string : iconv('euc-kr', 'utf-8', $string);
|
||||
|
||||
return $is_utf8;
|
||||
}
|
||||
|
||||
|
||||
function json_encode2($data) {
|
||||
switch (gettype($data)) {
|
||||
case 'boolean':
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue