You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by starz10de <fa...@yahoo.com> on 2011/12/16 20:54:27 UTC

URIEncoding

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: 

<filter> 
<filter-name>Set Character Encoding</filter-name> 
<filter-class>servlet.CharsetFilter</filter-class> 
<init-param> 
<param-name>encoding</param-name> 
<param-value>ISO-8859-1</param-value> 
</init-param> 
</filter> 

<!-- Define filter mappings for the defined filters --> 
<filter-mapping> 
<filter-name>Set Character Encoding</filter-name> 
<servlet-name>action</servlet-name> 
</filter-mapping> 


Any hint will be appreciated. 

-- 
View this message in context: http://old.nabble.com/URIEncoding-tp32989250p32989250.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: URIEncoding

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 12/16/11 3:37 PM, André Warnier wrote:
> 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.

I'm not so sure about that. Firefox has a setting for sending URLs in
UTF-8, and I suspect that that will override any in-page setting.
Curiously, there appears to be a separate setting for encoding of the
*query string* in UTF-8, and the default is "false" which I suspect
results in the behavior you have outlined above.

Basically, you should always test everything :)

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7ryVoACgkQ9CaO5/Lv0PBk5gCgqIXBx65DZDA9PkVJ142ob9qQ
3RQAn1If05tUjeX0XUViDLFkixSbWBwo
=iPir
-----END PGP SIGNATURE-----

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


Re: URIEncoding

Posted by André Warnier <aw...@ice-sa.com>.
starz10de wrote:
> I tried your suggestion:
> 
> http://localhost:8080//search/main?query=böse   (I make sure that it is
> inside some documents)
> 
> but the search return null 
> 

Remember : I have no idea what your application is, and what it is supposed to do or not.
Only you know that.

With the limited information you have provided so far, I can say this :

> here what I saw in the browser link bar after click on submit:
> 
> http://localhost:8080//search/main?query=b%F6se

This ---------------------------------------^
shows that the browser is sending the query-string as ISO-8859-1.
(the single code "%F6" is the URL-encoded version of the byte \xF6, which is "ö" in the 
iso-8859-1 encoding.)

If the browser was sending the query-string as UTF-8, then you would see

 > http://localhost:8080//search/main?query=b%C3%B6se
because the character "ö", in UTF-8-encoded Unicode , is represented by the two bytes 
\xC3\xB6.

Remember : you must *first* look at what the browser thinks about the page which contains 
the search link.  When that page is displayed in your browser, right-click on that page 
(or use the File menu), ask for "page information", look at "character set" or "encoding" 
(Kodierung ?)
If this page is seen as ISO-8859-1, then when you click on the search link in the page, 
the browser will send the request to Tomcat as ISO-8859-1.
If this page is seen as UTF-8, then the browser will send the request to the server as UTF-8.

If the server receives the request in one encoding, but is expecting another, then it will 
not understand the request properly, and (in your application) probably not find anything.
In other words :
- if you tell the server : URIencoding="UTF-8"
but the requests come in as ISO-8859-1, it will not work.
- if you tell the server : URIencoding="ISO-8859-1"
but the requests come in as UTF-8, it will not work.
- if both match, it should work.
- if you tell the server nothing, it will default to ISO-8859-1.

The above is all assuming that the requests are really sent as "GET", thus with all 
parameters in the URI query-string.
(That is what your original <form> tag seemed to indicate; but as you typed it or pasted 
it, your <form> tag looked incorrect.)

> 
> I also changed the browser encode to ISO but I couldn't retrieve any thing
> 
> any ideas?
> 
To contribute any more ideas, I need more information.

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


Re: URIEncoding

Posted by starz10de <fa...@yahoo.com>.
I tried your suggestion:

http://localhost:8080//search/main?query=böse   (I make sure that it is
inside some documents)

but the search return null 

here what I saw in the browser link bar after click on submit:

http://localhost:8080//search/main?query=b%F6se

I also changed the browser encode to ISO but I couldn't retrieve any thing

any ideas?





starz10de wrote:
> 
> 
> 
> 
> 
> awarnier wrote:
>> 
>>  
>>  
>> 
>>  
>>>Can you show *exactly* what you are doing in server.xml ?
>>>(paste the relevant portion here, remove comments and passwords)
>> 
>> 
>>  For the server.xml I can't modify any thing there, as I mentioned before
>> there are many other instances working there. If I can modify then I will
>> just kick the 'utf-8" from there, with the default value I have no
>> problem.
>> 
>>>I do not see anything in the above that submits anything with an
"umlaut".
>>>This is a "GET" request, so anything submitted would have to be in the
URL, as a query-string.
>>>I only see "name" here.  The quotes appear wrong too.
>>>There is also a double // after 8080, where it should not be.
>>>Are you sure it is not simply the "action" of your <form> which is wrong
?
>> 
>>>What are the <input> fields being submitted in your <form>, and what
value do you put in 
>>>it/them ?
>> 
>> It works fine and nothing wrong on it, at least I could submit the query
>> to the servlet and get the result back. Here how I send the reques:
>> 
>> <form action="http://localhost:8080//search/main?name method="get"
>> TARGET="Welcome">
>> 
>> <input maxlength=4000 size=40 name="query">   
>> <input type="submit" value="   Search  " style="background-color:#F8F8FF;
>> color: black;">
>> 
>> 
>>>Try the following, directly in your browser's URL bar :
>>>http://localhost:8080/Search/main?name=böse zeichen
>>>(note the ö-umlaut)
>>>What does that do ?
>> 
>> it doesn't work because when I submit the query I see just the main menu
>> jsp in the link bar.
>> 
>> Thanks for your response, is there any problem in what I mentioned?
>> 
>>  
> 
> 

-- 
View this message in context: http://old.nabble.com/URIEncoding-tp32989250p32994793.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: URIEncoding

Posted by starz10de <fa...@yahoo.com>.




awarnier wrote:
> 
>  
>  
> 
>  
>>Can you show *exactly* what you are doing in server.xml ?
>>(paste the relevant portion here, remove comments and passwords)
> 
> 
>  For the server.xml I can't modify any thing there, as I mentioned before
> there are many other instances working there. If I can modify then I will
> just kick the 'utf-8" from there, with the default value I have no
> problem.
> 
>>I do not see anything in the above that submits anything with an "umlaut".
>>This is a "GET" request, so anything submitted would have to be in the
URL, as a query-string.
>>I only see "name" here.  The quotes appear wrong too.
>>There is also a double // after 8080, where it should not be.
>>Are you sure it is not simply the "action" of your <form> which is wrong ?
> 
>>What are the <input> fields being submitted in your <form>, and what value
do you put in 
>>it/them ?
> 
> It works fine and nothing wrong on it, at least I could submit the query
> to the servlet and get the result back. Here how I send the reques:
> 
> <form action="http://localhost:8080//search/main?name method="get"
> TARGET="Welcome">
> 
> <input maxlength=4000 size=40 name="query">   
> <input type="submit" value="   Search  " style="background-color:#F8F8FF;
> color: black;">
> 
> 
>>Try the following, directly in your browser's URL bar :
>>http://localhost:8080/Search/main?name=böse zeichen
>>(note the ö-umlaut)
>>What does that do ?
> 
> it doesn't work because when I submit the query I see just the main menu
> jsp in the link bar.
> 
> Thanks for your response, is there any problem in what I mentioned?
> 
>  

-- 
View this message in context: http://old.nabble.com/URIEncoding-tp32989250p32994524.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: URIEncoding

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

André,

On 12/17/11 9:37 AM, André Warnier wrote:
> I do not see anything in the above that submits anything with an
> "umlaut".

The form could have additional <inputs> that were not included in the OP.

> This is a "GET" request, so anything submitted would have to be in
> the URL, as a query-string.

Most web browsers are smart enough to merge the query string from the
<form action> and form the <inputs> though I found dealt with an issue
recently where that didn't work properly. I can't remember what it
was... probably Safari.

> I only see "name" here.  The quotes appear wrong too.

+1

> There is also a double // after 8080, where it should not be.

It shouldn't be there, but it also shouldn't be a problem. It's just
sloppy.

> Are you sure it is not simply the "action" of your <form> which is
> wrong ?

If the above bug (failure to merge query-string and form <input>
parameters) is the problem, then the OP might end up with 'null' being
read from the request -- IIRC that was my observation.

The solution IMO is to always use POST whenever you are expecting
non-US-ASCII in your form inputs.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7vvNUACgkQ9CaO5/Lv0PAl/gCfbFlZ7mulTmeKrEr92WxIMh9+
QGoAoKjNZulYD0kibYrShP85dp2pZsxL
=fecP
-----END PGP SIGNATURE-----

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


Re: URIEncoding

Posted by André Warnier <aw...@ice-sa.com>.
starz10de wrote:
> Thanks a lot for your answer. I already did what you suggested:
> 
> <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

That's good.

> 
> but unfortunately the same problem. As I said when the default in the
> server.xml is "ISO-8859-1" all are fine. 

Can you show *exactly* what you are doing in server.xml ?
(paste the relevant portion here, remove comments and passwords)


I am dealing with English and
> German languages. The problem in the umlaut, when I submit it to the servlet
> it is not recognized.
> 
> here where I submit my request:
> 
> <form action="http://localhost:8080//Search/main?name method="get"
> TARGET="result">
> 

I do not see anything in the above that submits anything with an "umlaut".
This is a "GET" request, so anything submitted would have to be in the URL, as a query-string.
I only see "name" here.  The quotes appear wrong too.
There is also a double // after 8080, where it should not be.
Are you sure it is not simply the "action" of your <form> which is wrong ?

What are the <input> fields being submitted in your <form>, and what value do you put in 
it/them ?

Try the following, directly in your browser's URL bar :
http://localhost:8080/Search/main?name=böse zeichen
(note the ö-umlaut)
What does that do ?


> any more hint?
> 
> 
> 
> 
> awarnier wrote:
>> 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: 
>>>
>>> <filter> 
>>> <filter-name>Set Character Encoding</filter-name> 
>>> <filter-class>servlet.CharsetFilter</filter-class> 
>>> <init-param> 
>>> <param-name>encoding</param-name> 
>>> <param-value>ISO-8859-1</param-value> 
>>> </init-param> 
>>> </filter> 
>>>
>>> <!-- Define filter mappings for the defined filters --> 
>>> <filter-mapping> 
>>> <filter-name>Set Character Encoding</filter-name> 
>>> <servlet-name>action</servlet-name> 
>>> </filter-mapping> 
>>>
>>>
>>> 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 <form> 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 :
>> <meta http-equiv="content-type" content="text/html; charset=XXXXX" />
>> (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
>>
>>
>>
> 


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


Re: URIEncoding

Posted by starz10de <fa...@yahoo.com>.
Thanks a lot for your answer. I already did what you suggested:

<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1" />

but unfortunately the same problem. As I said when the default in the
server.xml is "ISO-8859-1" all are fine. I am dealing with English and
German languages. The problem in the umlaut, when I submit it to the servlet
it is not recognized.

here where I submit my request:

<form action="http://localhost:8080//Search/main?name method="get"
TARGET="result">

any more hint?




awarnier wrote:
> 
> 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: 
>> 
>> <filter> 
>> <filter-name>Set Character Encoding</filter-name> 
>> <filter-class>servlet.CharsetFilter</filter-class> 
>> <init-param> 
>> <param-name>encoding</param-name> 
>> <param-value>ISO-8859-1</param-value> 
>> </init-param> 
>> </filter> 
>> 
>> <!-- Define filter mappings for the defined filters --> 
>> <filter-mapping> 
>> <filter-name>Set Character Encoding</filter-name> 
>> <servlet-name>action</servlet-name> 
>> </filter-mapping> 
>> 
>> 
>> 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 <form> 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 :
> <meta http-equiv="content-type" content="text/html; charset=XXXXX" />
> (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
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/URIEncoding-tp32989250p32991998.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: URIEncoding

Posted by André Warnier <aw...@ice-sa.com>.
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: 
> 
> <filter> 
> <filter-name>Set Character Encoding</filter-name> 
> <filter-class>servlet.CharsetFilter</filter-class> 
> <init-param> 
> <param-name>encoding</param-name> 
> <param-value>ISO-8859-1</param-value> 
> </init-param> 
> </filter> 
> 
> <!-- Define filter mappings for the defined filters --> 
> <filter-mapping> 
> <filter-name>Set Character Encoding</filter-name> 
> <servlet-name>action</servlet-name> 
> </filter-mapping> 
> 
> 
> 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 <form> 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 :
<meta http-equiv="content-type" content="text/html; charset=XXXXX" />
(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


Re: URIEncoding

Posted by Christopher Schultz <ch...@christopherschultz.net>.
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

German Starz,

On 12/18/11 7:26 AM, starz10de wrote:
> I a login page (it has utf-8) I checked this also manually; after
> login is successful a jsp page will be called to enter the query.
> This jsp page use iso encoding although inside it utf-8 is
> defined.

Remember that the encoding of the response and the encoding of the
page are separate issues. If the page has been saved to the disk as
ISO-8859-1, the response can still be sent using UTF-8.

> I couldn’t understand from why the browser automatically user iso
> encoding although I force it to use utf-8.
> 
> Here how I do:
> 
> <meta http-equiv='Content-Type' content='text/html;
> charset=UTF-8'>

You should also be using:

<%@page pageEncoding="UTF-8" ... %>

or

<%@page contentType="text/html; charset=UTF-8" ... %>

I usually rig the JSP to grab the content type and charset directly
from the response, instead of hard-coding them. That way, the will
always be in sync:

<meta http-equiv="Content-Type" content="$response.contentType" />

(You /are/ using XHTML, right?)

Note that your response must have a definite character encoding set,
otherwise the default default default will be ISO-8859-1 and might not
be displayed in your Content-Type META tag.

- -chris
-----BEGIN PGP SIGNATURE-----
Version: GnuPG/MacGPG2 v2.0.17 (Darwin)
Comment: GPGTools - http://gpgtools.org
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk7vvp4ACgkQ9CaO5/Lv0PCxlgCgpf72A/Zr+XAd2q5UwdhFUF4v
M4MAoIeIqcXZevsN16jeyfi6IlMjF+NP
=D1A2
-----END PGP SIGNATURE-----

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


Re: URIEncoding

Posted by starz10de <fa...@yahoo.com>.
Thanks alot for your help. Yesterday I mentioned that the problem is solved
but strange I think my messages is not got by the forum. The problem was
using the :

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'> 

To change a encoding of a jsp page which is diudn’t work. I simply forget
that I am chanign the encoding of a jsp page and not html page. I used the
right command for a jsp page which is : 

<%@ page contentType="text/html;charset=UTF-8" %>

It works fine and force the page to use utf-8 encoding.

Thanks once again for your kind response.


awarnier wrote:
> 
> starz10de wrote:
>> One of my try to solve the problem is to use utf-8 in my html page as
>> well as
>> in my backend. It doesn’t work because the reason was that the Browser
>> change automatically to iso encoding. Today I checked the browser
>> encoding
>> before submit the query and saw that it use iso although in my html page
>> it
>> is utf-8. I changed to utf-8 manually and submit the query and it works
>> fine. 
>>
> Good. Now you are providing some real information.
> 
>> I a login page (it has utf-8) I checked this also manually; after login
>> is
>> successful a jsp page will be called to enter the query. This jsp page
>> use
>> iso encoding although inside it utf-8 is defined.
>> 
>> I couldn’t understand from why the browser automatically user iso
>> encoding
>> although I force it to use utf-8.
> 
> Neither do I, but let's find out.
> 
>> 
>> Here how I do:
>> 
>> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>
> 
> That looks correct.
> Which browser is it ?
> Did you get one of these plugins that I recommended ?
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tomcat.apache.org
> For additional commands, e-mail: users-help@tomcat.apache.org
> 
> 
> 

-- 
View this message in context: http://old.nabble.com/URIEncoding-tp32989250p33005252.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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


Re: URIEncoding

Posted by André Warnier <aw...@ice-sa.com>.
starz10de wrote:
> One of my try to solve the problem is to use utf-8 in my html page as well as
> in my backend. It doesn’t work because the reason was that the Browser
> change automatically to iso encoding. Today I checked the browser encoding
> before submit the query and saw that it use iso although in my html page it
> is utf-8. I changed to utf-8 manually and submit the query and it works
> fine. 
>
Good. Now you are providing some real information.

> I a login page (it has utf-8) I checked this also manually; after login is
> successful a jsp page will be called to enter the query. This jsp page use
> iso encoding although inside it utf-8 is defined.
> 
> I couldn’t understand from why the browser automatically user iso encoding
> although I force it to use utf-8.

Neither do I, but let's find out.

> 
> Here how I do:
> 
> <meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>

That looks correct.
Which browser is it ?
Did you get one of these plugins that I recommended ?

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


Re: URIEncoding

Posted by starz10de <fa...@yahoo.com>.
One of my try to solve the problem is to use utf-8 in my html page as well as
in my backend. It doesn’t work because the reason was that the Browser
change automatically to iso encoding. Today I checked the browser encoding
before submit the query and saw that it use iso although in my html page it
is utf-8. I changed to utf-8 manually and submit the query and it works
fine. 

I a login page (it has utf-8) I checked this also manually; after login is
successful a jsp page will be called to enter the query. This jsp page use
iso encoding although inside it utf-8 is defined.

I couldn’t understand from why the browser automatically user iso encoding
although I force it to use utf-8.

Here how I do:

<meta http-equiv='Content-Type' content='text/html; charset=UTF-8'>


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: 
> 
> <filter> 
> <filter-name>Set Character Encoding</filter-name> 
> <filter-class>servlet.CharsetFilter</filter-class> 
> <init-param> 
> <param-name>encoding</param-name> 
> <param-value>ISO-8859-1</param-value> 
> </init-param> 
> </filter> 
> 
> <!-- Define filter mappings for the defined filters --> 
> <filter-mapping> 
> <filter-name>Set Character Encoding</filter-name> 
> <servlet-name>action</servlet-name> 
> </filter-mapping> 
> 
> 
> Any hint will be appreciated. 
> 
> 

-- 
View this message in context: http://old.nabble.com/URIEncoding-tp32989250p32997524.html
Sent from the Tomcat - User mailing list archive at Nabble.com.


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