UTF-8 support in java application
Posted
by
jacekn
on Stack Overflow
See other posts from Stack Overflow
or by jacekn
Published on 2012-04-15T16:12:19Z
Indexed on
2012/04/15
17:29 UTC
Read the original article
Hit count: 175
I'm having trouble with UTF-8.
common.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%>
typical.jsp
<%@ include file="common.jsp" %>
Page Head
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
Form
<form id="screenObject" accept-charset="UTF-8" action="/SiteAdmin/articleHeaderEdit?articleId=15" method="post">
I enter non latin1 characters into a text field and click Save. Validator complains about another field and stops the submission. This never gets to the database, so database ability to handle UTF-8 is not in this picture. The page redisplays with appropriate error but the text that had been entered is all messed up. All non latin1 characters are converted to some gibberish.
I'm using Spring 3 MVC, in case that matters...
Attempts
Adding this to my view resolver didn't help:
<property name="contentType" value="text/html;charset=UTF-8" />
© Stack Overflow or respective owner