I have fixed the charset encoding problem in Tapestry 3.02. The problem is
that Tapestry generated web page sets charset to ISO-8859-1.
I've created CharsetFilter (servlet container filter, not Tapestry's), and
force UTF-8 encoding on both request and response.
public void doFilter(ServletRequest servletRequest, ServletResponse
servletResponse,
FilterChain filterChain) throws IOException, ServletException {
try {
servletRequest.setCharacterEncoding("UTF-8");
servletResponse.setContentType( "text/html; charset=UTF-8" );
I found the solution after digging at Google
(http://forum.java.sun.com/thread.jspa?threadID=539309&tstart=0
)
and by getting response to my Luntbuild blog entry
http://jroller.com/page/luntbuild?entry=problems_to_make_tapestry_talking.
I think the problem is that Tapestry, when it generates the html page does
not put Content-Type meta tag first:
<head>
<meta name="generator" content="Tapestry Application Framework, version
3.0.2"/>
<meta http-equiv="Content-Type" content="text/html;charset=UTF-8"/>
That might cause, that it is ignored (I have read it somewhere).
On 1/20/06, Lubos and Alena Pochman <[EMAIL PROTECTED]> wrote:
>
> I use Tapestry 3.02 and when I try to enter non-english/ansi text like
> "Génération" into text field (<input>), I get from Tapestry when
> creating the Java object that holds the data [G, Ã, (c), n, Ã, (c), r,
> a, t, i, o, n] or in bytes [71, 61, 87, 110, 61, 87, 114, 97, 116,
> 105, 111, 110], while I should get [G, é, n, é, r, a, t, i, o, n] or
> in bytes [71, 23, 110, 23, 114, 97, 116, 105, 111, 110].
>
> When I force the é char in debugger (Change value in Eclipse), when
> the Java object is created, everything else (rest of the system,
> display, storage) works OK. That is why I think it is Tapestry/Ognl
> input handling and Java object mapping.
>
> I set all the obvious/recommended utf-8 encoding.
>
> Any Tapestry multi-language experts?
>