Return-Path: X-Original-To: apmail-tomcat-users-archive@www.apache.org Delivered-To: apmail-tomcat-users-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id D88499A81 for ; Fri, 16 Dec 2011 20:37:50 +0000 (UTC) Received: (qmail 37826 invoked by uid 500); 16 Dec 2011 20:37:47 -0000 Delivered-To: apmail-tomcat-users-archive@tomcat.apache.org Received: (qmail 37745 invoked by uid 500); 16 Dec 2011 20:37:47 -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 37736 invoked by uid 99); 16 Dec 2011 20:37:47 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Dec 2011 20:37:47 +0000 X-ASF-Spam-Status: No, hits=-0.0 required=5.0 tests=SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of aw@ice-sa.com designates 212.85.38.228 as permitted sender) Received: from [212.85.38.228] (HELO tor.combios.es) (212.85.38.228) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 16 Dec 2011 20:37:39 +0000 Received: from [192.168.245.129] (p549E0ADF.dip0.t-ipconnect.de [84.158.10.223]) by tor.combios.es (Postfix) with ESMTPA id 0FB2CDA044A for ; Fri, 16 Dec 2011 21:37:15 +0100 (CET) Message-ID: <4EEBABF7.9050904@ice-sa.com> Date: Fri, 16 Dec 2011 21:37:11 +0100 From: =?ISO-8859-1?Q?Andr=E9_Warnier?= Reply-To: Tomcat Users List User-Agent: Thunderbird 2.0.0.23 (Windows/20090812) MIME-Version: 1.0 To: Tomcat Users List Subject: Re: URIEncoding References: <32989250.post@talk.nabble.com> In-Reply-To: <32989250.post@talk.nabble.com> Content-Type: text/plain; charset=ISO-8859-1; format=flowed Content-Transfer-Encoding: 7bit starz10de wrote: > I have an application which is running in local machine and it work perfect. > I installed my application in the server to make it available for all. In > the server we have tomcat running and provide services for many instances. > After I played my application in the server, I had problem with query which > have special language character. After long time, I could find where is the > problem. The problem was in server.xml where the URIEncoding is set to > "UTF-8". I made test and just removed this line or set it to "ISO-8859-1" > and all was perfect. My question here is it possible to set the URIEncoding > for each instance or is it possible to set it some where else. I send the > query from jsp page to the servlet. in my jsp page the charset=ISO-8859-1". > I tried to make all utf-8 but I couldn't success. I tried the filter > approach but also doesn't help: > > > Set Character Encoding > servlet.CharsetFilter > > encoding > ISO-8859-1 > > > > > > Set Character Encoding > action > > > > Any hint will be appreciated. > Hi. 1) By default, under HTTP (and HTML), the character set is ISO-8859-1. So, if you do not specify anything anywhere to say something else, everything should be understood and processed as ISO-8859-1. (**) 2) When a browser submits the contents of a
to a server, it will /generally/ use the same character set, as the one which /it thinks/ is the character set of the *current* page (the one which is currently shown on the screen == the one which contains the link or button which will send data to the server). So, what you need to do, is to look in the browser in the "Page info" or similar, which character set the browser believes is in effect for the current page. (*) 3) Normally also, this character set will be the one which, in the page source, is indicated by the following tag : (it is the XXXXX above) So make sure that all the pages that you send to the browser contain such a tag, with the correct character set. 4) Thus, if your pages are UTF-8, then any link in the page which "calls" the server, is going to send all values to the server in the UTF-8 character set. That includes the "query-string" part of URLs, and also the POST parameters which may be sent. If that is the case, you need to tell the server that it is so, because that is /not/ the default for HTTP. So that is when you should use the "URIencoding" parameter : if your forms are sending requests to the server containing a query-string. 5) if your forms are sending values by means of POST requests, then the situation gets more complicated, if you use a character set other than ISO-8859-1. But let's leave that for the next time. A question maybe, for later : what is/are the (human) language(s) that are used on your pages ? (*) I also /strongly/ advise, for issues of that nature, that you get a browser plug-in such as HttpFox or similar (for Firefox) or Fiddler2 (for Internet Explorer), to be able to check exactly what is being sent from the browser to the server and vice-versa. (**) Unfortunately, in Java the internal representation for characters and strings is Unicode, which can lead to mixups if you are not careful. Or, let me turn this around : it is much better to use Unicode as a character set, than any other "alphabet". But unfortunately, in the WWW, for historical reasons, the default is still ISO-8859-1, which creates many problems when one tries to deal with non-English languages. --------------------------------------------------------------------- To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org For additional commands, e-mail: users-help@tomcat.apache.org