Update string.utl.php

This commit is contained in:
Namhyeon Go 2018-09-10 02:01:12 +09:00 committed by GitHub
parent e081cfd05b
commit 92eb6ecbca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -25,30 +25,24 @@ if(!function_exists("parse_tel_number_kr")) {
}
if(!function_exists("get_converted_string")) {
function get_converted_string($str, $to_charset, $from_charset, $method="iconv") {
$output = "";
function get_converted_string($str, $to_charset, $from_charset) {
$result = false;
switch($method) {
case "iconv":
if($form_charset == "detect") {
if(function_exists("mb_detect_encoding") && function_exists("mb_detect_order")) {
$from_charset = mb_detect_encoding($str, mb_detect_order(), true);
} else {
$from_charset = "ISO-8859-1";
}
}
if(function_exists("iconv")) {
$result = iconv($from_charset, $to_charset, $str);
}
break;
case "mb":
if(function_exists("mb_convert_encoding")) {
} elseif(function_exists("mb_convert_encoding")) {
$result = mb_convert_encoding($str, $to_charset, $from_charset);
}
break;
default:
$output = $str;
}
if($result) {
$output = $result;
}
return $output;
return $result;
}
}