에러해결

[classic asp] 한글 깨짐 현상 해결

zzzin 2022. 4. 23. 22:44

asp를 사용하는데 한글이 자꾸 깨져서 구글링해서 해결했다.

 

일단 처음에 기본 코드만 있을 때는 아래와 같은 코드 세줄을 맨 위에 추가해주면 한글이 깨지지 않았다.

<%@Codepage = 65001 %>
<% Option explicit %>
<% Response.Codepage = 65001 %>

 

그런데 DB연결도 하고 나니까 저 코드가 있어도 문제가 해결이 안돼서 더 찾아봐서 해결했다.

다음과 같은 코드를 최상단에 추가해주면 DB연결했던 코드에서도 문제 해결 완료!

<%@Codepage = 65001 language="VBScript"%>

<%
    ' 한글깨짐 방지
    response.charset="UTF-8"
    session.codepage="65001"
    response.codepage="65001"
    Response.contentType="text/html;charset=UTF-8"
%>

 

 


참고: https://stackoverflow.com/questions/31524404/classic-asp-and-utf-8

 

Classic ASP and UTF-8

I'm changing my application to work with utf-8 pages. So every ASP page has this code Response.CodePage = 65001 Response.CharSet = "utf-8" And HTML <meta charset="UTF-8" /> <meta http-...

stackoverflow.com