示例#1
1
function jcode_convert_encoding($str, $to, $from = '')
{
    $jc_to = _check_encoding($to);
    $jc_from = _check_encoding($from);
    if ($jc_from == 0) {
        $jc_from = AutoDetect($str);
    }
    if ($jc_to == 4) {
        global $table_jis_utf8;
        include_once dirname(__FILE__) . '/code_table.jis2ucs';
    }
    if ($jc_from == 4) {
        global $table_utf8_jis;
        include_once dirname(__FILE__) . '/code_table.ucs2jis';
    }
    return JcodeConvert($str, $jc_from, $jc_to);
}
示例#2
0
function mb_detect_encoding($str, $encoding_list = '')
{
    global $mbemu_internals;
    if ($encoding_list == '') {
        $encoding_list = mb_detect_order();
    }
    if (!is_array($encoding_list)) {
        $encoding_list = strtoupper($encoding_list);
        if ($encoding_list == 'AUTO') {
            $encoding_list = mb_detect_order();
        } else {
            $encoding_list = split(', *', $encoding_list);
        }
    }
    foreach ($encoding_list as $encode) {
        if (_check_encoding($str, $mbemu_internals['encoding'][$encode])) {
            return $encode;
        }
    }
    return $encode;
}