php 엑셀 다운로드시에 ㅠㅠ한글깨짐이요 ㅠㅠㅠ 채택완료
안녕하세요. 그누보드 게시판 php 엑셀 다운로드 기능 추가해서
이용하고 있습니다.
해당 내용 엑셀로 받으면 이상하게 쿼리문이 조금만 추가되도 한글이 깨지는 현상이 발생하는대
혹시 왜그런지 알수있을까요...
해당 소스입니다.
</span></p><p><span style="font-size: 9pt;">header( "Content-type: application/vnd.ms-excel; charset=euc-kr" );</span></p><p><span style="font-size: 9pt;">header("Content-Disposition: attachment; filename=$_POST[poday].xls");</span></p><p><span style="font-size: 9pt;">header("Content-Description: PHP4 Generated Data");</span></p><p><span style="font-size: 9pt;">include "_common.php";</span></p><p> </p><p> </p><p><span style="font-size: 9pt;">if($_POST['chk_wr_id']) </span></p><p><span style="font-size: 9pt;">{</span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;">$in = implode(", ", $_POST['chk_wr_id']);</span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;">$where = "and wr_id IN($in)";</span></p><p><span style="font-size: 9pt;">}</span></p><p> </p><p> </p><p><span style="font-size: 9pt;">?></span></p><p><span style="font-size: 9pt;"><table border='1'></span></p><p><span style="font-size: 9pt;"><tr></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"><th scope="col" >상단</th></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"><th scope="col" ></span><span style="font-size: 9pt;">상단</span><span style="font-size: 9pt;"></th></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"><th scope="col" ></span><span style="font-size: 9pt;">상단</span><span style="font-size: 9pt;"></th></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"><th scope="col" ></span><span style="font-size: 9pt;">상단</span><span style="font-size: 9pt;"></th></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"><th scope="col" ></span><span style="font-size: 9pt;">상단</span><span style="font-size: 9pt;"></th></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"><th scope="col"></span><span style="font-size: 9pt;">상단</span><span style="font-size: 9pt;"></th></span></p><p><span class="Apple-tab-span" style="white-space: pre; font-size: 9pt;"> </span><span style="font-size: 9pt;"></tr></span></p><p><span style="font-size: 9pt;"><?</span></p><p><span style="font-size: 9pt;">$que = sql_query("SELECT * FROM g5_write_0003 where wr_id ".$where." ORDER BY wr_id DESC");</span></p><p><span style="font-size: 9pt;">while($row = sql_fetch_array($que)) {</span></p><p><span style="font-size: 9pt;">?></span></p><p><span style="font-size: 9pt;"><?</span></p><p><span style="font-size: 9pt;">}</span></p><p><span style="font-size: 9pt;">?></span></p><p><span style="font-size: 9pt;">
대충이런식으로 짜여있구요...
$que 의 쿼리문을
SELECT * FROM g5_write_0003 where wr_11 in(0,1) and wr_id ".$where." ORDER BY wr_id DESC
이런식으로 변경하면 phpmyadmin 에서는 결과도 이상없이나오고
엑셀받아도 나오는대 엑셀다운시 한글이 깨지는 현상이 발생합니다.ㅠㅠㅠ
고수님들 답변 부탁드리겠습니다
추가적으로
</span></p><p><span style="color: rgb(31, 31, 31); font-family: "맑은 고딕", "malgun gothic", 돋움, dotum, AppleGothic, sans-serif; font-size: 13px; background-color: rgb(255, 255, 255);">print("<meta http-equiv=\"Content-Type\" content=\"application/vnd.ms-excel; charset=euc-kr\">");</span><span style="font-size: 12px;"> </span></p><p><span style="font-size: 12px;">
이소스를 추가해도 동일한 현상이 발생됩니다.ㅠ
답변 3개
데이터 베이스에서 charset 을 euc-kr 로 셋팅을 해도 될거같구요.
아니면
글씨 나오는 부분을
iconv("UTF-8", "EUC-KR", "상단");
이렇게 해보는것도 방법일듯합니다.
답변에 대한 댓글 1개
댓글을 작성하려면 로그인이 필요합니다.
해당파일의 언어셋을 utf-8로 맞추시고 그냥 작업하시면 될듯 한데요...
출력시 아래 코드만 있어도 euc-kr로 엑셀을 잘 만들어 줍니다 제 경험상
header( "Content-type: application/vnd.ms-excel; charset=euc-kr";
답변에 대한 댓글 1개
결국 iconv로 모두 변환후 출력하였습니다....
감사합니다.
댓글을 작성하려면 로그인이 필요합니다.
답변을 작성하려면 로그인이 필요합니다.
로그인
왜 쿼리만 바꾸면 안나오는지 도무지도 모르겟네요 ㅠㅠㅠ
감사합니다.