Skip to content

Instantly share code, notes, and snippets.

@siebertm
Created December 13, 2011 10:59
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save siebertm/1471698 to your computer and use it in GitHub Desktop.
Save siebertm/1471698 to your computer and use it in GitHub Desktop.
tomcat encoding problem
# curl http://192.168.10.13:8080/solr/test.jsp --data q=Orthop%C3%A4die
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Character encoding test page</title>
</head>
<body>
<p>Data posted to this form was:
Orthopädie
</p>
</body>
</html>
<%@ page contentType="text/html; charset=UTF-8" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Character encoding test page</title>
</head>
<body>
<p>Data posted to this form was:
<%
//request.setCharacterEncoding("UTF-8");
out.print(request.getParameter("q"));
%>
</p>
</body>
</html>
....
(at the very top)
<filter>
<filter-name>SetCharacterEncodingFilter</filter-name>
<filter-class>org.apache.catalina.filters.SetCharacterEncodingFilter</filter-class>
<init-param>
<param-name>encoding</param-name>
<param-value>utf8</param-value>
<param-name>ignore</param-name>
<param-value>true</param-value>
</init-param>
</filter>
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment