728x90
출처 :
- http://www.experts-exchange.com/Web_Development/Web_Languages-Standards/XML/Q_24814185.html
CDATA 섹션에 허용되는 unicode range 만 남기기
private function strip_invalid_xml_chars( $in ) { $out = ""; // Used to hold the output. $current; // Used to reference the current character. if ( empty($in) ) { return ""; // vacancy test. } $length = strlen($in); for ( $i = 0; $i < $length; $i++) { $current = ord($in{$i}); if ( ($current == 0x9) || ($current == 0xA) || ($current == 0xD) || (($current >= 0x20) && ($current <= 0xD7FF)) || (($current >= 0xE000) && ($current <= 0xFFFD)) || (($current >= 0x10000) && ($current <= 0x10FFFF))) { $out .= chr($current); } else { $out .= " "; } } return $out; }
728x90
'tip' 카테고리의 다른 글
How to repair Windows Update Error 0×80070057 error codes (0) | 2013.04.27 |
---|---|
dll , ocx 등록시 0x80020009 에러 발생 (0) | 2013.04.27 |
http, https 혼용 Ajax 레이어팝업 로그인과 처리 (0) | 2013.04.27 |
CDATA 섹션[XML 표준] (0) | 2013.04.27 |
svn merge (0) | 2013.04.27 |
댓글