public function ucs2Encode($codePoints)
    {
        $outStr = '';
        foreach ($codePoints as $v) {
            if( 0x10000 <= $v && $v <= 0x10FFFF) {
                $v -= 0x10000;
                $w1 = 0xD800 | ($v >> 10);
                $w2 = 0xDC00 | ($v & 0x03FF);
                $outStr .= chr(0xFF & ($w1 >> 8)) . chr(0xFF & $w1);
                $outStr .= chr(0xFF & ($w2 >> 8)) . chr(0xFF & $w2);
            }else{
                $outStr .= chr(0xFF & ($v >> 8)) . chr(0xFF & $v);
            }
        }
        return $outStr;
    }