웹마스터 팁

1. editor
utf8 지원하는 에디터 아직 안씀?
edit+, ultraedit, dreamweaver, eclipse
저장시 utf8 로 저장 안하면 말짱 꽝.
euckr 환경이면 지금 그대로도 괜찮음.

2. ssh
file : ~/.bash_profile

export LANG=ko_KR.UTF-8
or
export LANG=ko_KR.EUC-KR

putty, securecrt 등의 ssh client 에서도 맞춰줘야 함.
설정하면? ls 할 때 글자 안깨짐. 끝.


3. ftp
서버설정 없음. (강제로 utf8 설정하는 패치가 있긴 하지만 정석은 아님.)
새 표준안에 문자셋에 관한게 있지만 대부분의 클라이언트가 지원 안함.
filezilla 에서 사이트관리자에 등록을 하면 문자셋 탭에서 UTF-8 이나 CP949 로 설정하면 됨.
설정하면? ftp 로 볼 때 글자 안깨지고, php 에서 UTF-8 로 파일명 쓸 수 있음.


4. web server (apache 등)
필요 없음. AddDefaultCharset 같은건 다 주석.


5. php
default_charset = utf-8
or
default_charset = x-windows-949

이거 안해주면 <script>alert('뷁!');</script> 할 때 브라우저가(특히 IE가) 글자 깨먹을 확률 높음.


6. html
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
or
<meta http-equiv="Content-Type" content="text/html; charset=x-windows-949" />

반드시 head 바로 밑에 meta
title 등 한국어가 위에 나오면 절대 안됨.


7. mysql
file: init 의 mysql 스크립트

--character-set-server=utf8
or
--character-set-server=euckr

옵션 변경
주의할 점은 처음 설치시 해야 한다는 것.
데이터가 있는데 이걸 바꾸면 다 깨짐.

mysql> show variables like 'ch%';
+--------------------------+----------------------------+
| Variable_name            | Value                      |
+--------------------------+----------------------------+
| character_set_client    | utf8                      |
| character_set_connection | utf8                      |
| character_set_database  | utf8                      |
| character_set_filesystem | binary                    |
| character_set_results    | utf8                      |
| character_set_server    | utf8                      |
| character_set_system    | utf8                      |
| character_sets_dir      | /usr/share/mysql/charsets/ |
+--------------------------+----------------------------+
8 rows in set (0.00 sec)

php 에서 접속시 mysql_query('set names utf8'); 하는 것을 추천.
my.cnf 에 character-set-client-handshake = false 하는 방법도 있는데 비추.


8. url
url 에 한글 등 멀티바이트 문자가 오면 무조건 utf8
구 ie 에는 이게 옵션이고 기본은 cp949 로 변환되게 되어있음.
404 에 fallback 으로 iconv 를 하는건 비추.
일단 charset=utf-8 헤더를 한번 만나면 utf8 로 인식할 것임.