I used to have similar problems with windows-1251 cyrylic codeapge and I solved it by
creating a siple filter, mapped to all request that explicitly sets the encoding of
the request before any1 else gets the request:
request.setCharacterEncoding("windows-1251");
I think this happens because Internet Explorer does not set the appropriate encoding
headers on HTTP level of the protocol and tomcat just assumes it is ISO8859-1 (leading
to garbage ofcourse)
Here is the full source of the filter:
package bg.cbm.servlet.filter;
import javax.servlet.*;
import java.io.IOException;
/**
* Creator: paltankov
* Date: 2003-10-30
* Time: 10:03:49
*/
public class LocaleHelperFilter implements Filter
{
private String defaultRequestEncoding = null;
public void init (FilterConfig filterConfig) {
defaultRequestEncoding =
filterConfig.getInitParameter("defaultRequestEncoding");
}
public void doFilter(ServletRequest request, ServletResponse response,
FilterChain chain)
throws IOException, ServletException {
if (null == request.getCharacterEncoding())
request.setCharacterEncoding(defaultRequestEncoding);
chain.doFilter(request, response);
}
public void destroy() {}
}
Here is the mapping entry for web.xml of the application that uses it:
<filter>
<filter-name>localeHelper</filter-name>
<filter-class>bg.cbm.servlet.filter.LocaleHelperFilter</filter-class>
<init-param>
<param-name>defaultRequestEncoding</param-name>
<param-value>windows-1251</param-value>
</init-param>
</filter>
<filter-mapping>
<filter-name>localeHelper</filter-name>
<url-pattern>*.jsp</url-pattern>
</filter-mapping>
I hope this helps (making my sleepless nights worth :)))
cheers
> -----Original Message-----
> From: K. Harvatis [mailto:[EMAIL PROTECTED]
> Sent: 12 Януари 2004 г. 13:53
> To: [EMAIL PROTECTED]
> Subject: Encoding issues
>
>
> I run Tomcat 3.2 and it reports "unsupported encoding
> iso-8859-7" when using FORMs. As a result, servlets receive
> garbage instead of data. Is there a workaround?
>
>
> Kostas Harvatis
> -----
> National Center for Social Research - Directorate of Research
> Support www.ekke.gr
>
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]