SOLVED: UTF-8 Problem with Tomcat 5.0.27 and POST
Hi, thanks to all who tried to help. In my case the fault was, the Character Encoding filter was not the first filter in the queue. The other hints: Setting the URIEncoding in the connectors and so on are useful as well. Sometimes you also must set the environment variable LC_CTYPE to something like de_DE.UTF-8. Cheers -- Mit freundlichen GrĂ¼ssen, Bernhard Fromberg Bernhard v. Fromberg | The Virtual Solution Reitmorstrasse 9 | 80538 Muenchen mailto: [EMAIL PROTECTED] Tel +49.89.291 651 26 | Fax +49.89.291 651 27 http://www.virtual-solution.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: UTF-8 Problem with Tomcat 5.0.27 and POST
Sorry, I was off for a while. It seems my problem comes in with Java1.5. I am not sure. I tried to set it up as shown below. Solves the GET problem. I use a filter. Solves nothing. I set it up in the struts-config file. No effect. It seems that something in between sets the request input stream to i do not know what. I have no idea what to do next. Struts version? Debug Servlet? I have no idea. Regards, Bernhard Hi all, I desperatly try to POST UTF-8 data to an application using struts. GET method works perfectly fine, but post does not. I am using CharacterEncodingFilter All pages have Content-Type header java1.5.0 update 2 Tomcat 5.0.27 various Un*x systems. I think this might be a similar question to one I asked recently and the following helped me -- Forwarded message -- From: Mark Thomas <[EMAIL PROTECTED]> Date: Apr 6, 2005 4:14 PM Subject: Re: URL encoding/decoding of UTF-8 characters - Hide quoted text - To: Tomcat Users List It is a lack of agreed standard problem. You can force Tomcat to use UTF-8 encoding by setting the URIEncoding parameter on the connector. There are some other parameters that you can set as well. See http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/http.html -- End Forwarded message -- Using link in this mail from the tomcat user maiIing list I have changed my connector settings to: That is I have added URIEncoding="UTF-8" and characters are now decoded correctly. Steve -- Mit freundlichen GrĂ¼ssen, Bernhard Fromberg Bernhard v. Fromberg | The Virtual Solution Reitmorstrasse 9 | 80538 Muenchen mailto: [EMAIL PROTECTED] Tel +49.89.291 651 26 | Fax +49.89.291 651 27 http://www.virtual-solution.de - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
RE: UTF-8 Problem with Tomcat 5.0.27 and POST
Steve, We have a similar requirement in that everything stored in the DB has to UTF-8. Well, to address this we have written an UTF-8 Filter which implements the Filter interface. All you need to do there is set the character encoding to UTF8. The class looks like this... public class UTF8Filter implements Filter { /** * default constructor */ public UTF8Filter() { super(); } /* (non-Javadoc) * @see javax.servlet.Filter#init(javax.servlet.FilterConfig) */ public void init(FilterConfig arg0) throws ServletException { // this doesn't need to do anything // } /* (non-Javadoc) * @see javax.servlet.Filter#doFilter(javax.servlet.ServletRequest, javax.servlet.ServletResponse, javax.servlet.FilterChain) */ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException { // set the encoding to UTF-8 on the request // req.setCharacterEncoding(IProcessor.UTF_8_ENCODING); // pass the filter along the chain // chain.doFilter(req, res); } /* (non-Javadoc) * @see javax.servlet.Filter#destroy() */ public void destroy() { // this doesn't need to do anything // } } In your web.xml define this filter and make sure all your request go through this filter. UTF8Filter uk.co.limehouse.publisher.struts.UTF8Filter UTF8Filter *.do Hope this helps... Arup -Original Message- From: Steve Bosman [mailto:[EMAIL PROTECTED] Sent: 12 May 2005 08:31 To: Tomcat Users List Subject: Re: UTF-8 Problem with Tomcat 5.0.27 and POST On 5/10/05, Bernhard v. Fromberg <[EMAIL PROTECTED]> wrote: > Hi all, > > I desperatly try to POST UTF-8 data to an application using struts. > GET method works perfectly fine, but post does not. > I am using CharacterEncodingFilter > All pages have Content-Type header > > java1.5.0 update 2 > Tomcat 5.0.27 > various Un*x systems. > I think this might be a similar question to one I asked recently and the following helped me -- Forwarded message -- From: Mark Thomas <[EMAIL PROTECTED]> Date: Apr 6, 2005 4:14 PM Subject: Re: URL encoding/decoding of UTF-8 characters - Hide quoted text - To: Tomcat Users List It is a lack of agreed standard problem. You can force Tomcat to use UTF-8 encoding by setting the URIEncoding parameter on the connector. There are some other parameters that you can set as well. See http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/http.html -- End Forwarded message -- Using link in this mail from the tomcat user maiIing list I have changed my connector settings to: That is I have added URIEncoding="UTF-8" and characters are now decoded correctly. Steve - 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]
Re: UTF-8 Problem with Tomcat 5.0.27 and POST
On 5/10/05, Bernhard v. Fromberg <[EMAIL PROTECTED]> wrote: > Hi all, > > I desperatly try to POST UTF-8 data to an application using struts. > GET method works perfectly fine, but post does not. > I am using CharacterEncodingFilter > All pages have Content-Type header > > java1.5.0 update 2 > Tomcat 5.0.27 > various Un*x systems. > I think this might be a similar question to one I asked recently and the following helped me -- Forwarded message -- From: Mark Thomas <[EMAIL PROTECTED]> Date: Apr 6, 2005 4:14 PM Subject: Re: URL encoding/decoding of UTF-8 characters - Hide quoted text - To: Tomcat Users List It is a lack of agreed standard problem. You can force Tomcat to use UTF-8 encoding by setting the URIEncoding parameter on the connector. There are some other parameters that you can set as well. See http://jakarta.apache.org/tomcat/tomcat-5.0-doc/config/http.html -- End Forwarded message -- Using link in this mail from the tomcat user maiIing list I have changed my connector settings to: That is I have added URIEncoding="UTF-8" and characters are now decoded correctly. Steve - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: Re: UTF-8 Problem with Tomcat 5.0.27 and POST
Hi Jimmy, Yes, true. From my debugging I am quite sure, that the encoding is correct, when the browser sends it off. When it arrives in the servlet the contents is messed up. It gets decoded in between the browser and the servlet. Struts always gives me the decoded data. So I think, that some decoder interprets the data as ISO-8859 and I have no idea, which one it is and how to teach it, to use a different encoding. But from what you said, I assume that it is somewhere in struts. Regards, Bernhard You dont really give enough details for your problem but... Maybe you have to decode the UTF-8 data. URLDecoder.decode("","UTF-8") should do the trick. Most GET requests are decoded before the request parameters reach the servlet. POST requests require the decode process. Regards, Jimmy Ray --- "Bernhard v. Fromberg" <[EMAIL PROTECTED]> wrote: Hi all, I desperatly try to POST UTF-8 data to an application using struts. GET method works perfectly fine, but post does not. I am using CharacterEncodingFilter All pages have Content-Type header java1.5.0 update 2 Tomcat 5.0.27 various Un*x systems. Tia Bernhard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: UTF-8 Problem with Tomcat 5.0.27 and POST
> I desperatly try to POST UTF-8 data to an application using struts. > GET method works perfectly fine, but post does not. > I am using CharacterEncodingFilter > All pages have Content-Type header I assume you're calling: response.setContentType( "text/html; charset=UTF-8" ); You'll also want to specify the following HTML header meta-tag in your JSPs: I'm not using Struts, so I account account for that fact. HTH Harry Mantheakis London, UK - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
Re: UTF-8 Problem with Tomcat 5.0.27 and POST
You dont really give enough details for your problem but... Maybe you have to decode the UTF-8 data. URLDecoder.decode("","UTF-8") should do the trick. Most GET requests are decoded before the request parameters reach the servlet. POST requests require the decode process. Regards, Jimmy Ray --- "Bernhard v. Fromberg" <[EMAIL PROTECTED]> wrote: > Hi all, > > I desperatly try to POST UTF-8 data to an > application using struts. > GET method works perfectly fine, but post does not. > I am using CharacterEncodingFilter > All pages have Content-Type header > > java1.5.0 update 2 > Tomcat 5.0.27 > various Un*x systems. > > Tia > Bernhard > > - > To unsubscribe, e-mail: > [EMAIL PROTECTED] > For additional commands, e-mail: > [EMAIL PROTECTED] > > Discover Yahoo! Have fun online with music videos, cool games, IM and more. Check it out! http://discover.yahoo.com/online.html - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
UTF-8 Problem with Tomcat 5.0.27 and POST
Hi all, I desperatly try to POST UTF-8 data to an application using struts. GET method works perfectly fine, but post does not. I am using CharacterEncodingFilter All pages have Content-Type header java1.5.0 update 2 Tomcat 5.0.27 various Un*x systems. Tia Bernhard - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]