iconv("euc-kr","utf-8","$connect"); 한번에 모든 언어셋 변경

extend/iconv.php

<?
echo getcwd()."<br>";
chdir('./gnuboard4');

echo getcwd()."<br>";
$dir="../gnuboard4";
euc2utf8($dir);
function euc2utf8($dir)
{
if(is_dir($dir))
 {
  if($dh=opendir($dir))
    {
      while(($file=readdir($dh)) !== false)
        {
if($file!="."&&$file!="..")
  {
      if(strcmp(strrchr($file,"."),".php")==0 or strcmp(strrchr($file,"."),".sql")==0)//php와sql가 들어간 파일을 찾는다.
{
$str=fopen("$dir/$file","r");//파일 읽어오기
$connect=fread($str,filesize("$dir/$file"));
fclose($str);//파일닫기
$connect=iconv("euc-kr","utf-8","$connect");//iconv함수로 문자열을 변환
$target=fopen("$dir/$file","w");
fwrite($target,$connect);
fclose($target);//파일닫기
echo $file."<br>";//파일명리스트 출력

}
euc2utf8("$dir/$file");

}

          }
  closedir($dh);//디렉토리 닫기
  }
 }
}
?>
|

댓글 1개

이거 문자열로 변환해 주는게 아니고... 그냥 잘못하면 다 날라가 버립니다.

utf-8에서 한 게시판에 문제가 있어서 한번 돌렸더니만 ....

<?
// 만 달랑 남기고 다 날라가 버립니다...

ㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠㅠ

댓글 작성

댓글을 작성하시려면 로그인이 필요합니다.

로그인하기
🐛 버그신고