You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tomcat.apache.org by Andre Tampold <An...@emk.ee> on 2001/07/10 20:04:42 UTC
How to solve the character encoding problem with JSP
Hello all Tomcat users!
I'm new to Tomcat. Installed it yesterday and it seems to me running very
well.
Only one question is arised, which probably is answered already, but I did
not found answer for that from archive.
Currently in production we have JavaWebServer2.0 / Win NT, JDK1.3 and this
works very well for solving encoding problem with JSP:
///////////////////////////////////////////////////////////////////////////
//
// How to solve the character encoding problem with JSP
// ----------------------------------------------------
//
// 1. Comment out this line in generated file's _jspService method:
// JspWriter out = null;
// 2. Insert this line where you commented out number 1:
// PrintWriter out = response.getWriter();
// 3. Comment out this line in generated file's _jspService method:
// out = pageContext.getOut();
// 4. At the end of the _jspService method you find:
// } catch (Throwable t) {
// * if (out.getBufferSize() != 0)
// * out.clear();
// Lines marked with * shall be commented out.
//
// 5. After lines mentioned in point 4 you find:
// HandleErrorPageException("...errorpage.jsp", t, out);
// Change it to:
// HandleErrorPageException("...errorpage.jsp", t,
pageContext.getOut());
///////////////////////////////////////////////////////////////////////////
Actually there are some Lexicon files in Cp1251, Cp1257 and UTF-8 encodings,
which need to come through JSP to browser. With JavaWebServer2.0 this is ok,
if we do as described in steps 1.-5.
How to do it with Tomcat? I did the same but it seems to me no effect at
all. Only ???????? marks or unreadable characters. What is missing?
Thanks in advance for any kind of info/URL/help,
Andre Tampõld
Software Development @ EMK