살려주세요... 게시글 엑셀 다운로드 할때 한글깨짐현상
본문
<?
header( "Content-type: application/vnd.ms-excel;charset=KSC5601");
header( "Content-Disposition: attachment; filename=list.xls" );
header( "Content-Description: PHP4 Generated Data" );
include "_common.php";
if($_POST['chk_wr_id']) {
$in = implode(", ", $_POST['chk_wr_id']);
$where = "WHERE wr_id IN($in)";
}
?>
<html>
<body>
<table border="1">
<tr>
<th>wr_id</th>
<th>title</th>
</tr>
<?
$que = sql_query("SELECT * FROM g5_write_".$_POST['bo_table']." ".$where." ORDER BY wr_id DESC");
while($row = sql_fetch_array($que)) {
?>
<tr>
<td><?=$row['wr_id']?></td>
<td><?=$row['wr_subject']?></td>
</tr>
<?
}
?>
</table>
</body>
</html>
다운받을때 한글이 계속 깨져서 나옵니다.
아래처럼 하면 한글이 안깨지고 잘 나오는데요..
아무래도 DB에서 불러 올때 파일 캐릭터셋을 변환해줘야 하는데
어느 파일에서 어떤부분에 어떤 소스를 수정해야 할지 모르겠습니다.
UTF-8서버 사용중입니다.
도와주세요 ㅠㅠ
<?
header( "Content-type: application/vnd.ms-excel;charset=KSC5601");
header( "Content-Disposition: attachment; filename=list.xls" );
header( "Content-Description: PHP4 Generated Data" );
?>
<html>
<body>
<table border="1">
<tr>
<td>한글이 안깨지고 잘 나와요</td>
</tr>
</table>
</body>
</html>
!-->!-->
답변 2
header(
"Content-type: application/vnd.ms-excel;charset=KSC5601"
);
charset 값이 잘못되었네요. 아래와 같이 바꿔주세요.
header(
"Content-type: application/vnd.ms-excel;charset=utf-8"
);
ㅅㄷㄴㅅ
답변을 작성하시기 전에 로그인 해주세요.