Skip to content

Instantly share code, notes, and snippets.

@omernaci
Created August 6, 2018 07:07
Show Gist options
  • Save omernaci/1b3dd369ffd899a2a635c2329a2245fa to your computer and use it in GitHub Desktop.
Save omernaci/1b3dd369ffd899a2a635c2329a2245fa to your computer and use it in GitHub Desktop.
Encoding Filter
...
public class CharacterEncodingFilter implements Filter {
public void init(FilterConfig config) throw ServletException {
}
public void doFilter(ServletRequest request, ServletResponse, FilterChain chain) throws IOException, ServletException {
request.setCharacterEncoding("UTF-8");
response.setCharacterEncoding("UTF-8");
chain.doFilter(request, response);
}
public void destroy() {
}
}
...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment