상세 컨텐츠

본문 제목

eclipse- servlet 완벽하게 utf-8 적용하기

카테고리 없음

by 개발혱 2013. 9. 4. 18:24

본문

 Tomcat에 기본적으로 활성화한  Server 폴더의 server.xml에 URIEncoding="UTF-8" 을 삽입하여 넣는다.


임의로 생성한 예제 파일에서   .java파일과 .html 파일에 직접적을 utf-8을 지정해줍니다.



servlet실행 할경우, 실행한 창이 깨진다면 

response.setContentType("text/html; charset="UTF-8")//내가 보내는 정보는 utf-8로 보내 줄 것이다

라는 것을 의미한다.

String header = "<head><meta http-equiv=\"Content-Type\" content=\"text/html; charset=utf-8\" /><title>"+title+"</title></head>";



<meta http-equiv="Content-Type" content="text\html;" charset="utf-8">


[window]-[preferences]에서 검색창에 'encod' 입력한 후 검색되는 것들을 전부 utf-8로 호환시켜준다.



지금 보이는 화면은 CSS Files, HTML Files, XML Files모두를 변경해준다.


쿠키의 경우 예외사항이 발생하는데 urlEncorder와 urlDecorder의 경우 한글을 사용할 수 있다.