한글 깨질 때 인코딩 설정하기
·
Development/Linux
locale 이 eucKR로 되어있는데 한글깨짐이 발생해서 utf8로 변경하였다. 현재 locale 확인 locale 확인해보니 모두 etcKR로 되어있다. vi ~/.bash_profile 추가 bash_profile에 환경변수 저장하기. 하단에 아래 코드를 넣는다. export LANG=ko_KR.UTF-8 재접속 후 확인 UTF-8로 변경되었다.
인코딩 깨질 때
·
Development/PHP
1. DB connect 확인 # DB Connent $DB = new db4mysql(); $DB -> getConnection(); mysql_query ( 'set names utf8' ); // 추가 인코딩 깨질 때는 EUC-KR 일 수 있으니 확인하기 2. 파싱하는 경우, Content-Type 추가해주기(UTF-8) $strParse.= "Content-Type: text/html;charset=UTF-8\r\n"; 3. iconv 함수 사용 # DE(독일어) $strBody = iconv("ISO-8859-1","utf-8", $strBody); + #그래도 깨질 경우, 각각 iconv함수를 사용한다. $strWrite = iconv("ISO-8859-1","utf-8", $strWrite)..