덤프 함수를 하나 만들었음..




// $s1은 UTF-8 인코딩된 '가'라는 문자열 변수라고 가정

$s1 = '가' // UTF-8

$s2 = iconv('UTF-8', 'EUC-KR', $s1); // EUC-KR


str_hex_dump($s1); // EA B0 80 (3 bytes)

str_hex_dump($s2); // B0 A1 (2 bytes)


function str_hex_dump($s)

{

    $a = unpack('C*', $s);


    $i = 0;

    foreach ($a as $v) {

        $h = strtoupper(dechex($v));

        if (strlen($h)<2) $h = '0'.$h;


        echo $h.' ';

        ++$i;

    }


    printf("(%d bytes)\n", $i);

}







Posted by bloodguy
,