메뉴 건너뛰기

프로그램언어

2016.12.22 15:41

깨진 한글 체크

조회 수 21278 추천 수 0 댓글 0
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄
?

단축키

Prev이전 문서

Next다음 문서

크게 작게 위로 아래로 댓글로 가기 인쇄

<?php
function is_regular_string($cstring)
{
    $slen = strlen($cstring);

    for($i=0;$i<$slen;$i++) 
    {
      // 1byte 문자 
      if(ord($cstring[$i])<=127) 
      {
          $i++;
      }
      // 2byte 문자             
      else if(ord($cstring[$i])>=hexdec('80')) 
      {
        if (isset($cstring{$i+1}) && $cstring{$i+1} != '' ) 
        {                    
           if(((ord($cstring{$i})>=hexdec('B0') && ord($cstring{$i+1})>=hexdec('A1')) && (ord($cstring{$i})<=hexdec('C8') && ord($cstring{$i+1})<=hexdec('FE'))) || ((ord($cstring{$i})>=hexdec('81') && ord($cstring{$i+1})>=hexdec('41')) && (ord($cstring{$i})<=hexdec('A0') && ord($cstring{$i+1})<=hexdec('FE'))) || ((ord($cstring{$i})>=hexdec('A1') && ord($cstring{$i+1})>=hexdec('41')) && (ord($cstring{$i})<=hexdec('C6') && ord($cstring{$i+1})<=hexdec('A0'))) || ((ord($cstring{$i})>=hexdec('A4') && ord($cstring{$i+1})>=hexdec('A1')) && (ord($cstring{$i})<=hexdec('A4') && ord($cstring{$i+1})<=hexdec('FE'))))
            {
            $i++;
            }
           else 
            {
             return false;
            }                
        }
      }
      else
      {
        return false;
      }
    }
    return true;
}
?>


  1. 파일 확장자 비교

    Date2016.12.22 Views23067
    Read More
  2. explode - 문자열 나눔

    Date2016.12.22 Views20974
    Read More
  3. 정규표현식 매치를 수행 (preg_match)

    Date2016.12.22 Views21104
    Read More
  4. 정규 표현식 검색과 치환 (preg_replace)

    Date2016.12.22 Views20077
    Read More
  5. $_FILES

    Date2016.12.22 Views24843
    Read More
  6. 대소문자 바꾸기 (strtoupper, strtolower)

    Date2016.12.22 Views20635
    Read More
  7. 문자열 뒤집기 (strrev)

    Date2016.12.22 Views19860
    Read More
  8. 이스케이프 함수 (htmlentities)

    Date2016.12.22 Views19503
    Read More
  9. 정규표현식 검사 도구 (ereg, eregi)

    Date2016.12.22 Views19510
    Read More
  10. 문자열의 태그를 그대로 출력 (htmlspecialchars)

    Date2016.12.22 Views18991
    Read More
  11. preg_match (정규표현식 매치를 수행합니다)

    Date2016.12.22 Views21936
    Read More
  12. 문자열에서 태그를 제거 (strip_tags)

    Date2016.12.22 Views18524
    Read More
  13. 문자열 찾기 (strstr)

    Date2016.12.22 Views19874
    Read More
  14. 깨진 한글 체크

    Date2016.12.22 Views21278
    Read More
  15. 로그인페이지에서 온 경우/로그인한 페이지로 이동

    Date2016.12.22 Views19858
    Read More
  16. 문자열 치환 (str_replace)

    Date2016.12.22 Views19739
    Read More
  17. 문자열 추출하기 (substr)

    Date2016.12.22 Views19887
    Read More
  18. $_SERVER 함수

    Date2016.12.22 Views24920
    Read More
  19. 링크를 걸때 http 처리방법

    Date2016.12.22 Views20019
    Read More
  20. 디렉토리 안의 파일의 내용들을 읽는 예

    Date2016.12.22 Views20147
    Read More
Board Pagination Prev 1 ... 8 9 10 11 12 13 14 15 16 17 Next
/ 17

하단 정보를 입력할 수 있습니다

© k2s0o1d4e0s2i1g5n. All Rights Reserved