If anyone has encountered the same problem, please respond urgently! Primoz
This bug report has been posted to the bug report submission page at java.sun.com; the reason for mailing it to you is simply because the exact software used is not included in the selection box, so we are not sure if the report will reach the correct party. We sincerely apologize if this email has caused you any inconveniences. Best regards, Novi Forum, d.o.o. Ljubljana, Slovenia -----The report In order to display Central European characters, the JSP page directive fails to recognize them when parsing the source file, and the generated servlet output results in latin1 (iso-8859-1) mappings instead. For example, try out the following simple JSP: ----begin source---- <%@ page contentType="text/html; charset=Cp1250" %> <HTML> test inline: <%= (char)138 %> <%-- Cp1250 keyboard mapping for unicode S with caron - a very lame workaround! --%> <br> <% String test = "\u0160"; // unicode: S with caron out.println("test unicode: " + test); // incorrect output in browser %> <br> test html: Š <%-- the typed character S with caron (CE fonts must be installed to see this) --%> </html> ----end source ---- Java source generated by the JSP engine: ------begin source ------ package D_0003a.Primoz.Projects.jsp.pages; import javax.servlet.*; import javax.servlet.http.*; import javax.servlet.jsp.*; import java.io.PrintWriter; import java.io.IOException; import com.sun.jsp.runtime.*; import java.beans.*; import com.sun.jsp.JspException; public class latin2test_jsp_1 extends HttpJspBase { public latin2test_jsp_1( ) { super("", true, 8192, true); } public void _jspService(HttpServletRequest request, HttpServletResponse response) throws IOException, ServletException { HttpSession session = null; ServletContext application = null; ServletConfig config = null; JspWriter out = null; Object page = this; String _value = null; try { application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); // begin out.write(""); // end // begin [file=D:\Primoz\Projects\jsp\pages\latin2test.jsp;from=(0,0);to=(0,51)] // end // begin out.write("\r\n\r\n<HTML>\r\n\r\n\r\ntest inline: "); // end // begin [file=D:\Primoz\Projects\jsp\pages\latin2test.jsp;from=(5,16);to=(5,27)] out.print( (char)138 ); // end // begin out.write("\r\n<br>\r\n"); // end // begin [file=D:\Primoz\Projects\jsp\pages\latin2test.jsp;from=(7,2);to=(10,0)] String test = "\u0160"; out.println("test unicode: " + test); // end // begin out.write("\r\n<br>\r\ntest html: `\r\n\r\n</html>\r\n"); // end } catch (Throwable t) { out.clear(); throw new JspException("Unknown exception: "+t); } finally { out.close(); } } } ------end source--------- The same problem occurs when setting the charset to iso-8859-2. It seems as if the parser incorrectly reads the source code and disregards the underlying content-type charset directive, thus producing default-encoded source code. If the JSP page contains the typed unicode letter "c with caron" - number 232 in Cp1250 and iso-8859-2, unicode: latin small c with caron, the parser generates a compile-time error reporting an invalid end-of-line termination error. The problem also occurs with no page directive given. ---begin source---- <%@ page contentType="text/html; charset=Cp1250" %> <HTML> <%-- typed unicode letter small c with caron (CE fonts required) --%> test html: č </html> ---end source--- Exception trace during compile time: ----begin trace------ JavaServer(tm) Web Dev Kit Version 1.0 EA Loaded configuration from file:D:\Primoz\Projects\jsp\default.cfg endpoint created: :8080 com.sun.jsp.runtime.JspServlet: init Scratch dir for JSP-generated servlets is: work\%3A8080%2F IMPORTANT: Do not modify the generated servlets JspEngine --> D:\Primoz\Projects\jsp\pages\latin2ccaron.jsp work\%3A8080%2F\latin2ccaron_jsp_1.java:46: String not terminated at end of line . out.write("\r\ntest html: ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: Invalid character in input. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: ')' expected. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: Invalid character in input. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: Invalid character in input. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: Invalid character in input. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: Invalid character in input. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: Invalid character in input. \r\n\r\n</html>\r\n"); ^ work\%3A8080%2F\latin2ccaron_jsp_1.java:47: String not terminated at end of line . \r\n\r\n</html>\r\n"); ^ 9 errors Unhandled error! You might want to consider having an error page to report such errors more gracefully com.sun.jsp.JspException: Compilation failed at com.sun.jsp.compiler.Main.compile(Main.java:248) at com.sun.jsp.runtime.JspLoader.loadJSP(JspLoader.java:117) at com.sun.jsp.runtime.JspServlet$JspServletWrapper.loadIfNecessary(JspS ervlet.java:71) at com.sun.jsp.runtime.JspServlet$JspServletWrapper.service(JspServlet.j ava:79) at com.sun.jsp.runtime.JspServlet.serviceJspFile(JspServlet.java:180) at com.sun.jsp.runtime.JspServlet.service(JspServlet.java:219) at javax.servlet.http.HttpServlet.service(HttpServlet.java:840) at com.sun.web.core.ServletWrapper.handleRequest(ServletWrapper.java:154 ) at com.sun.web.core.Context.handleRequest(Context.java:412) at com.sun.web.server.ConnectionHandler.run(Compiled Code) ----end trace ------- Java -version output: java version "1.1.8" Java -fullversion output: java full version "JDK1.1.8M" Software used: - Java Server Web Development Kit for Windows Early Access 2
