Tomcat 5.0.x では、conf/server.xml で指定する Connector の属性として useBodyEncodingForURIというのがあるので、これをtrue にする(c.f. http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/http.html)。あとは、従来通りにエンコードを統一してプログラムを作成すればいい。
Servletだと次のような感じかな。
request.setCharacterEncoding(“Windows-31J”);
String targetString = request.getParameter(“target”);
response.setContentType(“text/html; charset=Windows-31J”);
PrintWriter out = response.getWriter();
out.println(“<html>”);
out.println(“<head>”);
out.println(“<meta http-equiv=”Content-Type” content=”text/html; charset=Windows-31J”>”);
out.println(“</head>”);
String targetString = request.getParameter(“target”);
response.setContentType(“text/html; charset=Windows-31J”);
PrintWriter out = response.getWriter();
out.println(“<html>”);
out.println(“<head>”);
out.println(“<meta http-equiv=”Content-Type” content=”text/html; charset=Windows-31J”>”);
out.println(“</head>”);
JSPだと次のような感じかな。
<%@ page contentType="text/html; charset=Windows-31J" %>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-31J">
</head>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-31J">
</head>