tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Zsolt Koppany" <zkoppanyl...@intland.com>
Subject RE: Does from a filter setCharacterEncoding work for tc-5.0.27?
Date Thu, 03 Feb 2005 11:38:08 GMT

Here is my code. It doesn't matter what the variable encoding contains. I
didn't write it in my previous email but I don't have problems with forms (I
use struts) but with links that contain parameters encoded in "UTF8".


	public void doFilter(ServletRequest request,
		ServletResponse response, FilterChain chain)
		throws IOException,ServletException
	{
		dump(request, response);
       }

	protected void dump(ServletRequest request, ServletResponse
response)
	{
		try
		{
			String encoding = "ISO8859-1";
			encoding = "UTF8";
			request.setCharacterEncoding(encoding);
			response.setCharacterEncoding(encoding);
		}
		catch (UnsupportedEncodingException e)
		{
			log.error(e);
		}
		for (Enumeration en = request.getParameterNames();
			 en.hasMoreElements(); )
		{
			String pn = (String)en.nextElement();
			String pv = request.getParameter(pn);
			log.debug("Parameter <" + pn + "> value: <" + pv +
">");
		}
	}

> -----Original Message-----
> From: Guy Katz [mailto:gkatz@allot.com]
> Sent: Thursday, February 03, 2005 10:17 AM
> To: Tomcat Users List
> Subject: RE: Does from a filter setCharacterEncoding work for tc-5.0.27?
> 
> i used TC 5.0.19,0.25,0.27 &0.30 with a UTF-8 encoding filter (setting
> request and response encoding) and i never had any problems :) (and of
> course i use a language that cannot be represented with latin-1).
> 
> -----Original Message-----
> From: Zsolt Koppany [mailto:zkoppanylist@intland.com]
> Sent: Thursday, February 03, 2005 11:07 AM
> To: 'Tomcat Users List'
> Subject: RE: Does from a filter setCharacterEncoding work for tc-5.0.27?
> 
> 
> Thank you, but we cannot move to 5.5.4. How can I do the same with
> tc-5.0.27?
> 
> Zsolt
> 
> > -----Original Message-----
> > From: A jie [mailto:ajie2000@msn.com]
> > Sent: Thursday, February 03, 2005 2:44 AM
> > To: tomcat-user@jakarta.apache.org
> > Subject: RE: Does from a filter setCharacterEncoding work for tc-5.0.27?
> >
> >
> >
> >
> >
> > ----------------------
> >  MSN:Ajie2000@msn.com
> >  QQ:29967409
> > ---------------------
> >
> >
> >
> >
> > >From: "Zsolt Koppany" <zkoppanylist@intland.com>
> > >Reply-To: "Tomcat Users List" <tomcat-user@jakarta.apache.org>
> > >To: "'Tomcat Users List'" <tomcat-user@jakarta.apache.org>
> > >Subject: Does from a filter setCharacterEncoding work for tc-5.0.27?
> > >Date: Wed, 2 Feb 2005 15:33:07 +0100
> > >
> > >Hi,
> > >
> > >Does setCharacterEncoding work under tc-5.0.27 with java-1.4.2-06? To
> get
> > >UTF-8 request parameter I need to do:
> > >
> > >String par = request.getParameter("filename");
> > >String filename = new String(par.getBytes("ISO8859-1"), "UTF-8");
> > >
> > >request.setCharacterEncoding("UTF-8") doesn't seem to help from a
> filter.
> > >
> > >Is it my mistake?
> > >
> > >
> > >Zsolt Koppany
> > >Phone: +49-711-722 1874
> > >--
> > >Intland Software GmbH, Schulze-Delitzsch-Strasse 16
> > >D-70565 Stuttgart, Germany
> > >Phone: +49-711-722 1873, e-mail:zsolt.koppany@intland.com
> > >Fax: +49-711-722 1835
> > >
> > >
> > >
> > >
> > >
> > >
> > >---------------------------------------------------------------------
> > >To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > >For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> > >
> >
> > it works success under tomcat5.5.4.you should conf a web.xml
> >
> > _________________________________________________________________
> > 与联机的朋友进行交流,请使用 MSN Messenger:  http://messenger.msn.com/cn
> >
> >
> > ---------------------------------------------------------------------
> > To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> > For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org
> 
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: tomcat-user-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: tomcat-user-help@jakarta.apache.org




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


Mime
View raw message