Apache 2 가 자꾸 GET 방식의 파라미터 인코딩을 변경합니다.

kwon37xi의 이미지

Apache 2 + Tomcat 5.0.28 을 깔았습니다. mod_jk 1.2로 연동되어 있습니다. JkMount /*.jsp

헌데, 아파치 2가 자꾸 GET 방식으로 보내온 파라미터의 인코딩(encoding, charset, 문자셋)을 변경합니다.

Apache 2는 90 포트로(임시로..) 톰캣은 8080인데요,
GET 방식으로 URL인코딩을 하건(?p=%C7%D1%B1%DB) 그냥 한글을 쓰던(?p=한글)간에 무엇인가 다른 인코딩으로 바뀐 상태로 JSP에 전달됩니다.

POST 방식의 경우에는 전혀 문제 없고요, 물론 8080 포트를 통해 직접 Tomcat에 접속할 때도 문제 없습니다.

Tomcat은 server.xml 에 URIEncoding="EUC-KR" 이 설정되어 있습니다.

httpd.conf 에는

AddCharset EUC-KR      .euc-kr

AddDefaultCharset EUC-KR

아파치 2의 경우에는 mod_url 을 깔았다가 지웠습니다. mod_url.so 파일 자체를 완전 삭제하고 재시작했습니다.

다음 JSP를 통해서 아파치를 통해(90포트)로 테스트를 해 보면 Post 방식을 제외하고는 한글이 모두 깨집니다.

<%@ page contentType="text/html; charset=euc-kr" import="java.net.*"%>
<%
request.setCharacterEncoding("euc-kr");
String p = request.getParameter("p");
%>

<html>
<head>
<title>aa</title>
</head>
<body>
<a href="test.jsp?p=<%=URLEncoder.encode("한글","euc-kr")%>">한글 GET EUC_KR Encoded</a>
<br>
<a href="test.jsp?p=한글">한글 GET</a>
<br>
<form action="test.jsp" method="post">
<input type="hidden" name="p" value="한글">
<input type="submit" value="한글 Post">
</form>
<br>
값 :  <%= p %>
</body>
</html>
kwon37xi의 이미지

이래저래 하다가 해결했습니다.

    <Connector port="8009"
               enableLookups="false" redirectPort="8443" debug="0"
               protocol="AJP/1.3" URIEncoding="euc-kr"/>

톰캣 5.x의 경우에는 mod_jk.so 와 연결 부분에도 URIEncoding을 지정해야만 합니다.

mod_url.so 와도 아무 문제 없이 되는군요.

댓글 달기

Filtered HTML

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

BBCode

  • 텍스트에 BBCode 태그를 사용할 수 있습니다. URL은 자동으로 링크 됩니다.
  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param>
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.

Textile

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • You can use Textile markup to format text.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Markdown

  • 다음 태그를 이용하여 소스 코드 구문 강조를 할 수 있습니다: <code>, <blockcode>, <apache>, <applescript>, <autoconf>, <awk>, <bash>, <c>, <cpp>, <css>, <diff>, <drupal5>, <drupal6>, <gdb>, <html>, <html5>, <java>, <javascript>, <ldif>, <lua>, <make>, <mysql>, <perl>, <perl6>, <php>, <pgsql>, <proftpd>, <python>, <reg>, <spec>, <ruby>. 지원하는 태그 형식: <foo>, [foo].
  • Quick Tips:
    • Two or more spaces at a line's end = Line break
    • Double returns = Paragraph
    • *Single asterisks* or _single underscores_ = Emphasis
    • **Double** or __double__ = Strong
    • This is [a link](http://the.link.example.com "The optional title text")
    For complete details on the Markdown syntax, see the Markdown documentation and Markdown Extra documentation for tables, footnotes, and more.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 사용할 수 있는 HTML 태그: <p><div><span><br><a><em><strong><del><ins><b><i><u><s><pre><code><cite><blockquote><ul><ol><li><dl><dt><dd><table><tr><td><th><thead><tbody><h1><h2><h3><h4><h5><h6><img><embed><object><param><hr>

Plain text

  • HTML 태그를 사용할 수 없습니다.
  • web 주소와/이메일 주소를 클릭할 수 있는 링크로 자동으로 바꿉니다.
  • 줄과 단락은 자동으로 분리됩니다.
댓글 첨부 파일
이 댓글에 이미지나 파일을 업로드 합니다.
파일 크기는 8 MB보다 작아야 합니다.
허용할 파일 형식: txt pdf doc xls gif jpg jpeg mp3 png rar zip.
CAPTCHA
이것은 자동으로 스팸을 올리는 것을 막기 위해서 제공됩니다.