Re: Default character encoding for ServletRequest
Christopher Schultz wrote: On that page is a POST form. When I evaluate the posted data, they are NOT utf-8 encoded. /Most/ clients will act the way you expect, yet, there is no requirement for them to do so. What client is this, by the way? Firefox 3.5.3, IE7, Safari 4.0.3 See the W3C document for the form element, specifically the accept-charset attribute: http://www.w3.org/TR/html401/interact/forms.html#adef-accept-charset Read the part about UNKNOWN and how clients MAY interpret this as use the current page encoding. This is RFC 'MAY' which basically means it's a recommendation, but not at all required. If you configure your form like this, the client is essentially required to use your specified encoding if it expects the server to behave correctly: form action=... method=POST accept-charset=UTF-8 ... /form Give that a try and see what happens. Does neither work. But thanks. -Halm - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Default character encoding for ServletRequest
Hi Peter, Peter Crowther wrote: What are you trying to achieve? If we know more about the problem you're trying to solve, we may be able to suggest some different approaches. The client receives an HTML page with contentType=text/html; charset=utf-8 On that page is a POST form. When I evaluate the posted data, they are NOT utf-8 encoded. - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Default character encoding for ServletRequest
Hi Markus, thanks for your hints. Markus Meyer wrote: It all depends on the client. IIRC if you set the charset in the content type header to utf-8, like this contentType=text/html; charset=utf-8 most browsers will then use utf-8 for HTTP GET and POST requests when responding to the given page. No this doesn't work. Tomcat version 6.0.20, Firefox version 3.5.3, IE 7 -Halm - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Default character encoding for ServletRequest
Hi Andre-John, Andre-John Mas wrote: I wan't do it within the application. I prefer to configure the app container or the app itself. I had asked for this too a while back, but I was told the RFC indicates ISO-8859-1, so the developers didn't want to allow you to change the default encoding used by the application server, which is a shame. I say it is a shame, because we can already change the URL encoding and being able to standardise your deployment solutions on UTF-8 would be so much nicer, IMHO. Full ack. My solution was to use a character set filter, described here: http://wiki.apache.org/tomcat/Tomcat/UTF-8 I did that too, but in my opinion that is no solution, it is just an workaround. Thanks, Halm - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Default character encoding for ServletRequest
Hi, Calling %= request.getCharacterEncoding() % in a jsp deployed in a Tomcat 6.0.20 container returns null. Is there any possibility to force a default CharacterEncoding for such requests? Thanks in advance! Regards, -- SWITCH Serving Swiss Universities -- Halm Reusser, Software Engineer Werdstrasse 2, P.O. Box, 8021 Zurich, Switzerland phone +41 44 268 15 71, fax +41 44 268 15 68 halm.reus...@switch.ch, http://www.switch.ch - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org
Re: Default character encoding for ServletRequest
Pid wrote: How about? request.setCharacterEncoding(ENCODING); I wan't do it within the application. I prefer to configure the app container or the app itself. Bearing in mind that you're not really changing what the client requests, or might expect you to be setting... Is there a possibility to force the client to use a specific encoding? -Halm - To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org For additional commands, e-mail: users-h...@tomcat.apache.org