Return-Path: Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: (qmail 56483 invoked from network); 10 Jan 2008 19:28:38 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 10 Jan 2008 19:28:38 -0000 Received: (qmail 70726 invoked by uid 500); 10 Jan 2008 19:28:15 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 70706 invoked by uid 500); 10 Jan 2008 19:28:15 -0000 Mailing-List: contact users-help@tomcat.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: "Tomcat Users List" Delivered-To: mailing list users@tomcat.apache.org Received: (qmail 70695 invoked by uid 99); 10 Jan 2008 19:28:15 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2008 11:28:15 -0800 X-ASF-Spam-Status: No, hits=2.0 required=10.0 tests=HTML_MESSAGE,NORMAL_HTTP_TO_IP,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of amatijaca@gmail.com designates 72.14.252.153 as permitted sender) Received: from [72.14.252.153] (HELO po-out-1718.google.com) (72.14.252.153) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 10 Jan 2008 19:27:51 +0000 Received: by po-out-1718.google.com with SMTP id a23so1139895poh.4 for ; Thu, 10 Jan 2008 11:27:56 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:received:received:message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; bh=tyVDJAK+vTkdhRzGkmoRlW342SW0wl0dF+Uhf/kvtLo=; b=LPvJewMeQguUynHJuVM0wXWr2U2AQICHKXskoetcIg2HAlK2dnh5CIqbhKqTwUhBoULNJ3S7xyyvZ3+vTRAXfic7CENFteKrIE2ymcyOlrBhtdhtdcnZbOtxh4VQ7iQPGjyWHaV1oTv3T6lm6sIsjQlv0iQak0rht9OgidmNx6g= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=message-id:date:from:to:subject:in-reply-to:mime-version:content-type:references; b=MhISYw7aydcKUB00wb1ebUNZS4iorVqkoXAauV8k8I44meQdNHHov4EZif9C4SZf5ADYnc2R8ZRctsST9LfhEqbCCcx/2oixWc/Y6yjJSFKgif6/ZbeLo1ahoFy+cbFGpWxwBnZcXWZhyQm+KZTlj6yUHIvIpovzZznGk6HBaIE= Received: by 10.141.122.20 with SMTP id z20mr1428143rvm.293.1199993276709; Thu, 10 Jan 2008 11:27:56 -0800 (PST) Received: by 10.141.137.13 with HTTP; Thu, 10 Jan 2008 11:27:56 -0800 (PST) Message-ID: <442cdcf00801101127j362284beyc2ae0d94763dd10a@mail.gmail.com> Date: Thu, 10 Jan 2008 14:27:56 -0500 From: "Aleksandar Matijaca" To: "Tomcat Users List" Subject: Re: Tomcat 6 UTF-8 GET and POST - please Help.. In-Reply-To: <47866E30.7090803@oma.be> MIME-Version: 1.0 Content-Type: multipart/alternative; boundary="----=_Part_45741_1603461.1199993276716" References: <442cdcf00801101106q3e4b9242x2843694ab121f758@mail.gmail.com> <47866E30.7090803@oma.be> X-Virus-Checked: Checked by ClamAV on apache.org ------=_Part_45741_1603461.1199993276716 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline I will try the filter, and let you know -- I don't think that Struts is too worried about the encoding, while debugging, I saw that things go wrong much earlier, "above" struts, in the regular servlet layer on which Struts Action sits... Thanks for the suggestion.. You know, it is really disappointing, that one has to do "custom programming" (filter) depending on what kind of a container engine is used - in the ideal world, this should just work for all different application servers.. God only knows, what if anything I would have to do for Websphere, Weblogic= , Oracle server etc... Thanks for your help. Alex. On Jan 10, 2008 2:12 PM, David Delbecq wrote: > As you might infer, URIEncoding=3D"UTF-8" only work on the Uri part, and > thus affect only GET. The post is decoded using the browser provided > "content-encoding". Most borwser don't bother to set that header. > Behaviour of tomcat is to then use some default (ISO-8859-1). Best way > to ensure tomcat will use UTF-8 for post decoding is to force it using > request.setCharacterEncoding("UTF-8"), before any call to > getParameter(s). a filter or a valve might be a good place :) > > btw, be carefull, struts (i see you use struts) tends to also have his > default behaviour when decoding POST :) > > > > Aleksandar Matijaca a =E9crit : > > Hi there, > > > > I am having some issue with submitting foreign language fonts in HTML > form > > to Tomcat. > > If I set up the FORM with method=3D"GET" everything works just fine. > However, > > when I use > > POST, things don't work - I get garbled characters in my servlet from > the > > FORM. > > In the example below, I am showing the headers for both > > GET and POST - the character being sent is a single lower case letter > "f" in > > cyrillic. > > > > > > ************************************************ > > > > The POST method does not work - gives garbled characters - please note > that > > the mytext is PROPERLY ENCODED IN BOTH methods - GET and POST, > > so I don't think that it is a browser issue (i think that my HTML is ok > > too). > > > > > > http://localhost:8080/Inter/takeText.do > > > > POST /Inter/takeText.do HTTP/1.1 > > Host: localhost:8080 > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11= ) > > Gecko/20071127 Firefox/2.0.0.11 > > Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=3D0.= 9 > > ,text/plain;q=3D0.8,image/png,*/*;q=3D0.5 > > Accept-Language: en-us,en;q=3D0.8,sr;q=3D0.5,hi;q=3D0.3 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > Referer: http://localhost:8080/Inter/takeText.do > > Cookie: JSESSIONID=3Dyhhvgybm2jfa; sensitivity=3D1000.0; > > JSESSIONID=3DAF8D24C63CE9C16D5DF78E5CDDE26146 > > Content-Type: application/x-www-form-urlencoded > > Content-Length: 13 > > mytext=3D%D1%84 > > > > > > ******************************************************************** > > > > This is the request using GET - this works just fine - the servlet gets > > mytext nicely decoded... > > > > > > http://localhost:8080/Inter/takeText.do?mytext=3D%D1%84 > > > > GET /Inter/takeText.do?mytext=3D%D1%84 HTTP/1.1 > > Host: localhost:8080 > > User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.11= ) > > Gecko/20071127 Firefox/2.0.0.11 > > Accept: text/xml,application/xml,application/xhtml+xml,text/html;q=3D0.= 9 > > ,text/plain;q=3D0.8,image/png,*/*;q=3D0.5 > > Accept-Language: en-us,en;q=3D0.8,sr;q=3D0.5,hi;q=3D0.3 > > Accept-Encoding: gzip,deflate > > Accept-Charset: ISO-8859-1,utf-8;q=3D0.7,*;q=3D0.7 > > Keep-Alive: 300 > > Connection: keep-alive > > Referer: http://localhost:8080/Inter/takeText.do?mytext=3D%D1%84 > > Cookie: JSESSIONID=3Dyhhvgybm2jfa; sensitivity=3D1000.0; > > JSESSIONID=3DAF8D24C63CE9C16D5DF78E5CDDE26146 > > > > > > > > *********************************************** > > My HTML (rendered from the JSP) > > > > > > > > > > /> > > > > > > > >
> action=3D"/Inter/takeText.do" accept-charset=3D"UTF-8" > > > > > > >
> > > > > > > > ************************************************ > > > > This is the configuration of the Tomcat Connector - if I REMOVE > URIEncoding, > > both GET and POST don't work any more. > > > > > connectionTimeout=3D"20000" URIEncoding=3D"UTF-8" > > redirectPort=3D"8443" /> > > > > ************************************************ > > > > > > Thanks for any insight you can give me here... I really don't want to > > change ALL my forms to GET - there should be > > an easier (and more natural) fix for this. > > > > Thanks, Alex. > > > > > > > --------------------------------------------------------------------- > To start a new topic, e-mail: users@tomcat.apache.org > To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org > For additional commands, e-mail: users-help@tomcat.apache.org > > ------=_Part_45741_1603461.1199993276716--