Hi
The JSP page that I am using has Greek and Latin Characters. I am unable to display it properly in the browser.
I am fetching data from the a Oracle Database which is stored in UTF-8 . When I display it on the browser this the characters are getting garbled. Ex- Grønbæk
If I change the View-->Encoding--> to UTF-8 then I am able to view it properly  as Ex- Grønbæk
 
1.I am setting the the following META tag
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">
But still when I check it up in the browser the encoding setting is ISO-8859-1
 
2. I have tried setting the response.setContentType("text/html;charset=UTF-8"); This also does not work.
3. I have tried putting  <%@ page contentType = "text/html;charset=UTF-8" %>. This also does not work.
 
4. I have changed the setting Tomcat4.1.18 for web.xml file to
 <filter>
        <filter-name>Set Character Encoding</filter-name>
        <filter-class>filters.SetCharacterEncodingFilter</filter-class>
        <init-param>
            <param-name>encoding</param-name>
            <param-value>UTF-8</param-value>
        </init-param>
    </filter>
 
 
5. I thought there might be a problem with the Apache webserver and then I set this in the httpd.conf file
AddDefaultCharset UTF-8 (default is ISO-8859-1)
Having done all the setting still I am unable to the view the characters properly.
 
I am running Tomcat4.1.18 with Apache2.0.34 using the JK2 Connector on Solaris 5.8.
 
Code snippet which I have used.
 
<html>
<%@ page import="java.util.*" %>
<%@ page import="java.io.*" %>
<%@ page import="java.sql.*" %>
<head>
<META http-equiv="Content-Type" content="text/html; charset=UTF-8">

</head>
<%
 
                Class.forName(driverClassName);
                Connection con = DriverManager.getConnection(dbURL, user, passwo
rd);
                con.setAutoCommit(false);
                Statement stmt=null;
                ResultSet rst=null;
                stmt = con.createStatement();
                String testString=null;
 
                try {
 
 
 
                rst = stmt.executeQuery(queryString);
                }
                catch(SQLException e)   {
                        System.out.println("error while fetching data from old t
able.");
                        System.out.println("Error message: "+e.getMessage());
                        return;
                }
 
                while(rst.next())
                {
                        testString = rst.getString(1);
 
                        out.println("LastNAME "+ testString);
 
                 }
 
%/>
</body>
</html>
 
7. I have also tried using the String.getBytes("UTF-8); But this also does not work.
 

I would like to know if any other setting also needs to be made for in addtion to what I have done so that it works.
 
Joshua Sunil Kumar
 

 

**************************Disclaimer************************************************** 
   
 
 Information contained in this E-MAIL being proprietary to Wipro Limited is 
'privileged' 
and 'confidential' and intended for use only by the individual or entity to which it 
is 
addressed. You are notified that any use, copying or dissemination of the information 
contained in the E-MAIL in any manner whatsoever is strictly prohibited.

****************************************************************************************

Reply via email to