PlanetJava
Custom Search

java-stripes-user
[Top] [All Lists]

Re: UTF8 from form to mySQL

Subject: Re: UTF8 from form to mySQL
Date: Sat, 5 Feb 2011 10:16:44 +0200
> Really???  A filter just to set character encoding???  Although I imagine it 
> would work isn't that a little sledge hammer-ish ;-)
I seem to recall it was the recommended practice.
> 
> Why not just put the following at the top of each of your JSPs (or tweak as 
> necessary):
> <%@ page language="java" pageEncoding="UTF-8" 
> contentType="text/html;charset=UTF-8" %>
> 
> That will ensure your web page supports UTF-8.
No, it will just ensure that it outputs UTF-8; it does not say anything about 
incoming request (which is what the request.setCharacterEncoding() does.)
> As far as Stripes is concerned you don't have to do anything for it to 
> support UTF-8... and Java retains all Strings in unicode so no issue there 
> either.
The problem stems from the fact that servlet spec says that the default input 
encoding is ISO-8859-1. Especially older browsers do not send the character 
encoding correctly, so you're better off declaring the input encoding 
explicitly.
Please see Servlet specification version 2.5 Section SRV.3.9.
/Janne
------------------------------------------------------------------------------
The modern datacenter depends on network connectivity to access resources
and provide services. The best practices for maximizing a physical server's
connectivity to a physical network are well understood - see how these
rules translate into the virtual world? 
http://p.sf.net/sfu/oracle-sfdevnlfb
_______________________________________________
Stripes-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/stripes-users
msgmiddle
<Prev in Thread] Current Thread [Next in Thread>
Current Sitemap | © 2012 planetjava | Contact | Privacy Policy