-
1. Re: Incorrect chars when submitting a form
fabiovc27 Apr 30, 2012 8:18 PM (in response to japochino1)Sounds like a character encoding issue.
make sure you're setting the character encoding in your application.
are you writing to a file from java?
If so use -Dfile.encoding=UTF-8
are you writing to a database?
if so, there might be some properties you need to set in your connection string... for example in our MySQL connection string we had to modify the connection string to be as follows :
jdbc:mysql://${host}${port}/${db_name}?useUnicode=true&characterEncoding=UTF-8
hope that helps
-fv
-
2. Re: Incorrect chars when submitting a form
japochino1 May 1, 2012 3:22 AM (in response to fabiovc27)I want to persist into a database but the character changes BEFORE they are persisted to the database.
I noticed this when I debug, I click the submit button and before the call to the method that make the persist, the data are already wrong.
-
3. Re: Incorrect chars when submitting a form
japochino1 May 1, 2012 6:10 AM (in response to japochino1)Finally I found in the Internet a solution with a Filter and the method:
...
private static String ENCODING = "UTF-8";
...
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain) throws IOException, ServletException {
System.out.println("CharacterEncodingFilter... doFilter");
request.setCharacterEncoding(ENCODING);
response.setCharacterEncoding(ENCODING);
chain.doFilter(request, response);
}
But I think it should exists a more eficient way to do this!?
Thank you very much