Ivo Panacek wrote: >> response.setContentType("text/html; charset=ISO-8859-2"); >> >> So, no trouble there. How do I get a (Unicode) string to convert to a >> ISO-8859-2 encoded byte stream? Because, eventually, that is what the >> browser should get. I cannot use the method from above, since >> JspWriter doesn't accept byte[] as an argument. > > > Java does it for you. If you retrieve output stream AFTER setting > content type > with out = pageContext.getOut(); you write to out in UNICODE and output > is in ISO-8859-2.
Hmmm, since I'm in a JSP page and not Servlet, this should be done automagically. When I run Jasper on the "test.jsp" file, this is what I get: TEST.JSP -------- <%@ page info="A test page" contentType="text/html; charset=ISO-8859-2" %> <%! String testText; %> <% testText = "\uC5A0 \uC5A1 \uC486 \uC487 \uC48C \uC48D \uC490 \uC491 \uC5BD \uC5BE"; %> <html> <head> <title>Test page</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-2"> </head> <body bgcolor="#FFFFFF" text="#000000"> <h1>Test page for encoding issues</h1> <p>And this is generated: <%= testText %></p> <p>And this is from a scriptlet: <% out.write( testText.getBytes("LATIN2") ); %> <p>Nix.</p> </body> </html> TEST.JAVA --------- [SNIP] response.setContentType("text/html; charset=ISO-8859-2"); pageContext = _jspxFactory.getPageContext(this, request, response, "", true, 8192, true); application = pageContext.getServletContext(); config = pageContext.getServletConfig(); session = pageContext.getSession(); out = pageContext.getOut(); [SNIP] ----------- So, the "out" object IS obtained AFTER the content type has been set. Still, both <%= testText %> and the scriptlet produce the same result - "?" instead of Latin-2 characters. It might be the JVM issue and I'll look into the possible options for setting the default output encoding, tomorrow. BTW, I'd say you're using LATIN-2, so how do browser go about it? I have tried to create a static HTML page with what I believe is Latin-2 text (I have the right keyboard mapping). The result is frustrating, all characters are there, except small s-caron and small z-caron (capitals are OK). Any idea? Nix. -- To unsubscribe: <mailto:[EMAIL PROTECTED]> For additional commands: <mailto:[EMAIL PROTECTED]> Troubles with the list: <mailto:[EMAIL PROTECTED]>