utf8

范例

将字符串转成utf8

function convertStringToUtf8($string)
{
    $string = urldecode($string);
    $encoding = mb_detect_encoding($string, array('ASCII', 'UTF-8', 'GB2312', 'GBK', 'BIG5'));
    $string = mb_convert_encoding($string, 'UTF-8', $encoding);
    return $string;
}


参见