velocity-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Shinobu Kawai Yoshida <shinobu.ka...@gmail.com>
Subject Re: problem with latin2
Date Wed, 19 Jan 2005 13:05:41 GMT
Hi guys,

> The problems is often that the text goes trough an extra charset
> encodings/decodings when you try to examine it for debugging purposes,
> and this can obliterate the traces of the root problem. To spot where
> exactly the problem happens, print (e.g. log) the text on various phases
> (e.g. when you get the request parameters) with *character codes*, that
> is, with numbers. Then check if the printed UCS codes are OK at that
> point. (As a catalog of UCS codes you may use "UniBook".)

Adding to Daniel's comment, as it is stated in the javadocs, "This
method must be called prior to reading request parameters or reading
input using getReader()."  So the only feasible solution I find with
Struts is using a Filter.

> >> http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/ServletRequest.html#setCharacterEncoding(java.lang.String)
> >>
> >>Using Filter works for me.  :)
> >>   http://java.sun.com/j2ee/1.4/docs/api/javax/servlet/Filter.html

And here's an example of what one might look like:
public class PolishFilter implements Filter {
  public void doFilter(ServletRequest request, ServletResponse
response, FilterChain chain) throws IOException, ServletException {
    request.setCharacterEncoding("iso-8859-2");
    chain.doFilter(request, response);
  }
}
## I'm leaving out unimplemented methods.

Best regards,
-- Shinobu

--
Shinobu "Kawai" Yoshida <shinobu.kawai@gmail.com>

---------------------------------------------------------------------
To unsubscribe, e-mail: velocity-user-unsubscribe@jakarta.apache.org
For additional commands, e-mail: velocity-user-help@jakarta.apache.org


Mime
View raw message