[opencms-dev] Latest Opencms prob with encoding

Martin Kuba makub at ics.muni.cz
Mon Apr 26 12:32:01 CEST 2004


Alexander Kandzior wrote:
> Vangelis,
> 
> if you want to help with the encoding this would be greatly appreciated. 
> 
> Since you apparently are used to work in a different charset then
> ISO-8859-1, I have a simple question for you (and for everyone else
> experienced in this encoding issues):
>  
> When you create a regular HTML web form with a JSP (not in OpenCms, just
> standard JSP), and you want your users to be able to enter greek chars, how
> do you handle the encoding for such a form? How do you make sure that when
> you on the server site do a <% String str =
> request.getParameter("greekinput"); %> after posting the form have the chars
> actually encoded in greek? 
> 
> Actually, I already have a pretty clear picture on how I think this works,
> but I want to check with someone who does this on a regular basis to see if
> I am  right or missing something. 
> 
> Best Regards,
> Alex.

Sorry for replying so late, I am currently catching up with my emails ...
I am also very interested in maintainign an internationalized site in 
OpenCMS and I am willing to help. The charsets I usualy use are
ISO-8859-2 and UTF-8.

When you receive a submitted form, the parameters are in the same
encoding as was the page with the form. You have to call
request.setCharaterEncoding() to convert them so that
request.getParameter() will return correct Java characters.
This call is best to place into a class extending javax.servlet.Filter
and configured as filter for all requests in web.xml

One thing to be aware of is that in TomCat 5 parameters trasmitted
in URL (i.e. GET parameters or in the case of POST additional parameters
from the URL) are *NOT* affected by request.setCharacterEncoding()
unless you set a flag on the TomCat Coyote connector in server.xml.
I had a disscussion about this on the TomCat list, but the TomCat
authors decided that it is the right thing to do and internationalized
data should not be transmitted in URL. The discussion was quite
heated and the only result was the flag for backward compatibility.

Best regards,

Martin
-- 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Supercomputing Center Brno             Martin Kuba
Institute of Computer Science    email: makub at ics.muni.cz
Masaryk University             http://www.ics.muni.cz/~makub/
Botanicka 68a, 60200 Brno, CZ     mobil: +420-603-533775
--------------------------------------------------------------



More information about the opencms-dev mailing list