만들면서 배우는 CodeIgniter Q&A

제목 그림4-1결과화면에서 한글이 전부 깨져서 나오네여.
글쓴이 스마트남 작성시각 2014/03/19 18:37:29
댓글 : 6 추천 : 0 스크랩 : 0 조회수 : 9038   RSS
저랑 같은문제 있으신분 있어서 검색을 해보았으나, 별 도움이 되지 않아 글 올립니다.

한글도 깨지고, css도 제대로 먹지를 않네요.

브라우저 인코딩도 바꿔보았으나, 되질 않는군요

그리고, 데이터 입력은 sqlgate라는 툴을 써서 입력했습니다.



소스도 첨부합니다.
board.php
<?php if(!defined('BASEPATH')) exit('No direct script access allowed');
 
class Board extends CI_Controller
{
function __construct()
{
parent::__construct();
$this->load->database();
$this->load->model('board_m');
}
 
public function index()
{
$this->lists();
}
 
 
public function _remap($method)
{
$this->load->view('header_v');
 
if(method_exists($this, $method))
{
$this->{"{$method}"}();
}
 
$this->load->view('footer_v');
}
 
 
 
public function lists()
{
$data['list'] = $this->board_m->get_list($this->uri->segment(3));
$this->load->view('board/list_v',$data);
}
}

list_v.php
<article id="board_area">
<header>
<h1></h1>
 
<table cellspacing="0" cellpadding="0">
<thead>
<tr>
<th scope="col">번호</th>
<th scope="col">제목</th>
<th scope="col">작성자</th>
<th scope="col">조회수</th>
<th scope="col">작성일</th>
</tr>
</thead>
<tbody>
<?php
foreach($list as $lt)
{
?>
<tr>
<th scope="row">
<?php echo $lt->board_id;?>
</th>
<td><a rel="external" href="/bbs/<?php echo $this->uri->segment(1);?>/view/<?php echo $this->uri->segment(3);?>/<?php echo $lt->board_id;?>"><?php echo $lt->subject;?></a></td>
<td><?php echo $lt->user_name;?></td>
<td><?php echo $lt->hits;?></td>
<td><time datetime="<?php echo mdate("%Y-%M-%j", human_to_unix($lt->reg_date));?>"><?php echo mdate("%M. %j, %Y", human_to_unix($lt->reg_date));?></time></td>
</tr>
<?php
}
?>
</tbody>
</table>
</article>
 
 다음글 게시판에 다중 검색 조건을 넣고 싶은 경우 (4)
 이전글 57p 화면출력 오류 확인 좀 부탁드립니다. (2)

댓글

변종원(웅파) / 2014/03/19 18:57:55 / 추천 0
db의 내용만 깨져서 나오는거네요.
db 생성하실때 utf8_general_ci 로 생성하셔야 합니다.
latin1 이런거면 수정하고 데이터 입력 다시 해보세요.
그리고 mysql gui툴은 heidiSQL 추천합니다.(무료)
스마트남 / 2014/03/19 19:04:31 / 추천 0
 감사합니다. 데이터베이스 생성할때 캐릭터셋이 있는줄몰랐네요~
스마트남 / 2014/03/20 11:39:21 / 추천 0
말씀해주신 부분도 수정을 했는데도. 제대로 안나오더군요.
그래서 다른 부분들도 전부 체크를 해보았습니다.
1. 웹브라우저의 캐릭터셋
2. 웹서버의 캐릭터셋
3.데이터베이스 서버의 캐릭터셋
4.생성되어 있는 데이터베이스의 캐릭터셋
5.DB에 접속하는 세션의 캐릭터셋.

전부 확인했으나, 문제가 없더군요.
지금 제가 SQLGATE사용하는데요. 이거 말고 그냥 콘솔창에서 테이블 다시 생성하고, 값을 넣어줬더니,
PHP ADMIN상에서도 제대로 값이 보이고, 화면에서도 값이 제대로 보이더군요.

쿼리를 입력하는 툴도, 캐릭터셋을 결정하는데 관계가 있는지요?
변종원(웅파) / 2014/03/20 13:24:02 / 추천 0
sqlgate에 캐릭터셋 따로 설정하는게 있을겁니다.

다른 툴 사용하세요. ^^;;
유마 / 2014/03/24 11:37:36 / 추천 0
 해결하셨는지 모르겠지만, 테이블의 케릭터셋도 확인해보세요.
스마트남 / 2014/04/04 14:16:21 / 추천 0
 해결되었습니다. 툴문제였네요