Html & Script

자바스크립트 한글처리 UTF-8

페이지 정보

본문

euc-kr -> utf-8 때문에 한글이 깨지는 경우가 종종있다

1. Meta Tag 사용 : 본문에 아래와 같이 메타테그를 삽입하여주세요!

 

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

 

 

2. javascript 사용시 encodeURIComponent()를 활용하여 한글데이터 인코딩.

 

<SCRIPT LANGUAGE="JavaScript">
<!--
 function ShippingOpen(){
  sitelink = "http://www.test.com/1234/index.jsp"
  sitelink = sitelink + "?username="+encodeURIComponent("<%=user_name%>");
  window.location.href=sitelink;
 }
//-->
</SCRIPT>

관련자료

등록된 댓글이 없습니다.
Today's proverb
생각은 자유롭고 독립적인 듯 보이지만 인간은 생각보다 더 강한 것을 가지고 있다. 그것은 생각을 인도할 수 있는 능력이다.