Update string.utl.php

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

View File

@ -27,22 +27,27 @@ 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 = "";
$result = false;
switch($method) {
case "iconv":
if(function_exists("iconv")) {
$output = iconv($from_charset, $to_charset, $str);
$result = iconv($from_charset, $to_charset, $str);
}
break;
case "mb":
if(function_exists("mb_convert_encoding")) {
$output = mb_convert_encoding($str, $to_charset, $from_charset);
$result = mb_convert_encoding($str, $to_charset, $from_charset);
}
break;
default:
$output = $str;
}
if($result) {
$output = $result;
}
return $output;
}
}