php
엑셀파일 다운로드 시 한글깨짐 현상
관절분리
2016. 1. 25. 14:34
반응형
엑셀파일을 다운받을 때, 특정 정보들만 깨짐 현상이 있어 헤더를 수정하였다.
깨지기 전 헤더는 이렇게 쓰고 있었다.
-
header( "Content-type: application/vnd.ms-excel" );
header( "Content-Disposition: attachment; filename=$_POST[filename].xls" );
header( "Content-Description: PHP4 Generated Data" );
header( "Content-charset=euc-kr" );
-
수정한 헤더는 이렇다.
-
header( "Content-type: application/vnd.ms-excel; charset=euc-kr" );
header( "Content-Disposition: attachment; filename=$_POST[filename].xls" );
header( "Content-Description: PHP4 Generated Data" );
print("<meta http-equiv=\"Content-Type\" content=\"application/vnd.ms-excel; charset=euc-kr\">");
-
자신의 환경에 따라 charset을 설정하여 쓰면 될듯하다.
[데브피아를 참조했다 :D]
출처 : http://kaiserinlee.thoth.kr/?mid=blog&document_srl=1751668
반응형