tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Tim Tye" <>
Subject Re: charset used for parameters decoding on HTTP request Tomcat3.x,4
Date Tue, 13 Feb 2001 02:15:27 GMT
charset used for parameters decoding on HTTP request Tomcat3.x,4Because of the way byte values
are URL encoded, (and the way tomcat decodes them.) What you usually receive with get parameters
is a byte stream one byte per character.  You can post process the string obtained by getParameter
by converting it back to a byte array, then convert to a string and specify the encoding.

  ----- Original Message ----- 
  From: Adalbert Wysocki 
  Sent: Monday, February 12, 2001 12:00 PM
  Subject: charset used for parameters decoding on HTTP request Tomcat3.x,4

  Hi all, 

  I would like to know the policy for the request's parameters decoding in Tomcat 3.x. 
  In Servlet 2.3 specifications a new method on the HttpServletRequest object was added in
order to be able to specify the request's parameters charset encoding. This charset is used
futhermore while the parameters parsing. This method is implemented in Tomcat 4.

  What is about Tomakat 3.2 implementing the servlet 2.2 specifications where the charset
for parameters' decoding cannot be specified and considering that browsers never send the
form encoding charset in th erequests' headers. In the case pages generated by my servlet
run with Tomcat 3.2 are UTF-8 encoded, and requests for theses pages contain UTF-8 encoded
parameters, how can I specify to the servlet engine running my servlet to decode parameters
from UTF-8 and not using the default plateform encoding (8859-J, Shift_JIS (for japan plateforms)...).

  These are my questions: 

    - is Tomcat 3.2 supports double byte encoded parameters (I sew that parameters are parsed
with javax.servlet.http.HttpUtils that does not support double byte encoded parameters)

    - if it is possible, how to do it. 

  NB: A solution would be to overwrite the system property "file.encoding" on the command
line. But on exotic platforms (such as Korean), overwriting the property "file.encoding" on
the command line while the servlet engine starting is not taken under consideration while
the default characters-bytes/bytes-characters converters instantiation (this behavior is listed
in Sun's bugs list but is not considered as a bug). In these cases the default plateform encoding
is used.


  Adalbert Wysocki, software engineer 
  phone: +33 (0)1 
  fax: +33 (0)1 

View raw message