구매고객
판매자
솔루션별 질문
객관적이지 않은 사유는 인정되지 않으며, 신고 권한이 제재될 수 있습니다.
0/200
신고 사유에 해당하지 않는 글을 신고하면 신고 권한이 제한될 수 있습니다.
이 회원의 커뮤니티 콘텐츠와 알림을 내 화면에서만 숨깁니다.
신고는 접수되지 않으며, 숨긴 회원은 내 정보에서 다시 보이게 할 수 있습니다.
신고할 글이 아닌가요? 이 회원만 숨기기
신고하기로 돌아가기
그누보드4 관련 질문은 QA 로 이전됩니다. QA 그누보드4 바로가기 기존 게시물은 열람만 가능합니다.
전체 67032개 중 40601-40620번째
댓글 4개
우선 데이터에서 첫번짜 글짜를 잘른후
그 글자를 str_replace 를 이용해 변환후 출력해야 할거 같습니다.
자바스크립으로 가능할거 같은데 찾아봐도 안나오네요.
수정해 쓰시면됩니다.
<?php
function GetUtf8String($str) {
$arr_cho = array(
"ㄱ", "ㄲ", "ㄴ", "ㄷ", "ㄸ", "ㄹ", "ㅁ",
"ㅂ", "ㅃ", "ㅅ", "ㅆ", "ㅇ", "ㅈ", "ㅉ",
"ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ");
$arr_jung = array(
"ㅏ", "ㅐ", "ㅑ", "ㅒ", "ㅓ", "ㅔ", "ㅕ",
"ㅖ", "ㅗ", "ㅘ", "ㅙ", "ㅚ", "ㅛ", "ㅜ",
"ㅝ", "ㅞ", "ㅟ", "ㅠ", "ㅡ", "ㅢ", "ㅣ");
$arr_jong = array(
"", "ㄱ", "ㄲ", "ㄳ", "ㄴ", "ㄵ", "ㄶ",
"ㄷ", "ㄹ", "ㄺ", "ㄻ", "ㄼ", "ㄽ", "ㄾ",
"ㄿ", "ㅀ", "ㅁ ", "ㅂ", "ㅄ", "ㅅ", "ㅆ",
"ㅇ", "ㅈ", "ㅊ", "ㅋ", "ㅌ", "ㅍ", "ㅎ");
$unicode = array();
$values = array();
$lookingFor = 1;
for ($i = 0; $i < strlen( $str ); $i++ ) {
$thisValue = ord( $str[ $i ] );
if ( $thisValue < 128 ) {
$unicode[] = $thisValue;
} else {
if ( count($values)==0) $lookingFor = ($thisValue<224) ? 2 : 3;
$values[] = $thisValue;
if (count($values)==$lookingFor) {
$number = ($lookingFor==3) ? (($values[0]%16)*4096) + (($values[1]%64)*64) + ($values[2]%64) : (($values[0]%32)*64)+($values[1]%64);
$unicode[] = $number;
$values = array();
$lookingFor = 1;
}
}
}
$splitStr = '';
while (list($key, $code) = each($unicode)) {
if ($code>=44032 && $code<=55203) {
$temp = $code-44032;
$cho = (int)($temp/21/28);
$jung = (int)(($temp%(21*28)/28));
$jong = (int)($temp%28);
$splitStr.= $arr_cho[$cho].$arr_jung[$jung].$arr_jong[$jong];
} else {
$temp = array($unicode[$key]);
foreach($temp as $ununicode) {
if ( $ununicode<128) {
$splitStr.= chr($ununicode);
} elseif ($ununicode<2048) {
$splitStr.= chr(192+(($ununicode-($ununicode%64))/64));
$splitStr.= chr(128+($ununicode%64));
} else {
$splitStr.= chr(224+(($ununicode-($ununicode%4096))/4096));
$splitStr.= chr(128+((($ununicode%4096)-($ununicode%64))/64));
$splitStr.= chr(128+($ununicode%64));
}
}
}
}
$splitStr = str_replace(' ','',$splitStr);
return $splitStr;
}
// UTF-8 문자열 생성
$str = iconv('euc-kr','utf-8','이곳내요을 초성 중성 종성으로 분리해줍니다.);
echo GetUtf8String($str);
?>