tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From André Warnier ...@ice-sa.com>
Subject Re: URIEncoding
Date Sun, 18 Dec 2011 13:04:12 GMT
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


Mime
View raw message