마지막 수정 날짜 : 2017년 4월 11일
Windows 시스템에서 phpSysInfo 를 사용하려고 하면 다음과 같은 오류가 뜰 경우가 있다.
위 문제를 임시/정확하게 해결 하는 방법이다.
임시 해결 방법
[phpSysInfo 설치 경로]/includes/xml/class.SimpleXMLExtended.inc.php 의 내용 중…아래와 같이 강조 된 부분1을 수정하면 된다.
173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 |
private function _toUTF8($str) { /*if ($this->_encoding != null) { if (strcasecmp($this->_encoding, "UTF-8") == 0) { return trim($str); } elseif (strcasecmp($this->_encoding, "CP437") == 0) { $str = trim($str); $strr = ""; if (($strl = strlen($str)) > 0) for ($i = 0; $i < $strl; $i++) { $strc = substr($str, $i, 1); if ($strc < 128) $strr.=$strc; else $strr.=$_CP437toUTF8Table[$strc-128]; } return $strr; } else { $enclist = mb_list_encodings(); if (in_array($this->_encoding, $enclist)) { return mb_convert_encoding(trim($str), 'UTF-8', $this->_encoding); } elseif (function_exists("iconv")) { return iconv($this->_encoding, 'UTF-8', trim($str)); } else { return mb_convert_encoding(trim($str), 'UTF-8'); } } } else { return mb_convert_encoding(trim($str), 'UTF-8'); }*/ return trim($str); } |
해결 방법
https://github.com/phpsysinfo/phpsysinfo
가서 받아라(…)
이 글의 댓글로 달아주신 peter 님께서 버그 리포팅을 하셨고, phpSysInfo 개발자분들이 수정을 해 주셨다. (만세!)
정확히는 해당 커밋을 참고하면 된다.
https://github.com/phpsysinfo/phpsysinfo/commit/6d1c36ec51a2d74c05a48e199f79748dbe40ae20
https://github.com/phpsysinfo/phpsysinfo/commit/0ba9ce1d04ed789024f837d010afc3160b7803e2
https://github.com/phpsysinfo/phpsysinfo/commit/41c8f681830b57ee63ea35f94ed5c43904b785ee
안 되는 이유(…)
윈도에서 거지같은 UTF-8 를 제대로 지원하지 않기 때문인 것2 같은데, 이유를 좀 더 분석 해 봐야 겠다. (…)
windows-949 등의 몇몇 코드셋을 인식하지 못 해서 생기는 오류였다.
현재 최신버전(Github 소스 기준 3.2.8 이상) 에서는 정상 동작한다.