Hi, I have a problem with displaying Japanese characters (read from a database) in JSP, and I can really use some pointers!!
================================ Set-up: 1) I have used this: <%@ page contentType="text/html; charset=Shift_JIS" %> on the first line of the page, and <meta http-equiv="Content-Type" content="text/html; charset=Shift_JIS"> in the header section. 2) I have both static Japanese characters (in the HTML) and dynamic ones (generated from database-reads). ================================ Results: The static Japanese characters are displayed correctly, but the generated ones are garbage. Nothing happens when I try to manually change the encoding to Shift_JIS in the browser (say, encoding->Japanese (Shift_JIS) ). What I tried: 1) Remove the first page directive. => This caused all Japanese characters to be displayed as ???'s, BUT, BUT, when I manually change the encoding, all of them suddenly display correctly. 2) Changed the page directive to using charset=ISO-8859-1 AND, AND, add another line right below it: response.setContentType("text/html; charset="Shift_JIS"); (I read that the page directive tells how the page is encoded, and response.setContentType tells the browser what encoding to use.) This gave me garbage all over, both the static Japanese AND the dynamic. 3) Keeping the set-up from (2), reverse the charset options <%@ page contentType="text/html; charset="Shift_JIS" %> <% response.setContentType("text/html; charset="ISO-8859-1"); %> This gives me the same output as the original problem. ================================ What I actually want is for the page to display correctly, using the encoding automatically, without the user having to manually set the encoding. How do I achieve that other than what's mentioned above?? The database data is correct: I have telnetted to the machine from Windows, and viewed the data from the database. The data is displayed correctly. My environment is this: Apache/Tomcat 4.0.1, Red Hat Linux, Java 1.3, with a pack of Java Beans (NOT EJB's) using SQL to access the database, MySQL. NOTE: What drivers me NUTS is this - static Japanese displays properly, BUT dynamic ones don't. WHY???? Do I have to change the encoding of the "out" writer or something?? Thanks in advance! James =========================================================================== To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST". For digest: mailto [EMAIL PROTECTED] with body: "set JSP-INTEREST DIGEST". Some relevant FAQs on JSP/Servlets can be found at: http://archives.java.sun.com/jsp-interest.html http://java.sun.com/products/jsp/faq.html http://www.esperanto.org.nz/jsp/jspfaq.jsp http://www.jguru.com/faq/index.jsp http://www.jspinsider.com