예제 #1
0
	function decodeUTF8($array) {
 
        foreach ($array as $k => $postTmp) {
                if (is_array($postTmp)) {
                        $array[$k]= decodeUTF8($postTmp);
                }else{
                        $array[$k] = utf8_decode($postTmp);
                }
        }
 
        return $array;
	}
예제 #2
0
function decodeBase64($str)
{
    $i = 0;
    $enc = '';
    do {
        // unpack four hexets into three octets using index points in b64
        $h1 = strpos($b64, $str[$i++]);
        $h2 = strpos($b64, $str[$i++]);
        $h3 = strpos($b64, $str[$i++]);
        $h4 = strpos($b64, $str[$i++]);
        $bits = $h1 << 18 | $h2 << 12 | $h3 << 6 | $h4;
        $o1 = $bits >> 16 & 0xff;
        $o2 = $bits >> 8 & 0xff;
        $o3 = $bits & 0xff;
        if ($h3 == 64) {
            $enc += chr($o1);
        } elseif ($h4 == 64) {
            $enc += chr($o1 . $o2);
        } else {
            $enc += chr($o1 . $o2 . $o3);
        }
    } while ($i < strlen($str));
    return decodeUTF8($enc);
    // decode UTF-8 byte-array back to Unicode
}