Hi all,
I have a mysql (5.0.19) database containing UTF-8 encoded data (greek).
I'm trying to show this data through Tomcat 5.5.16 and JSP.
I start my page like this:
<%@ page import = "java.sql.*" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<%
// Connect to the database
Class.forName("com.mysql.jdbc.Driver").newInstance();
String dbURL = "jdbc:mysql://localhost:3306/mydb?useUnicode=true&characterEncoding=utf-8";
Connection connection = DriverManager.getConnection( dbURL, "myuser", "mypass" );
Statement statement = connection.createStatement();
%>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
If I show the page like this the data is ok, but I need to set the encoding by hand in my browser. This way I see my strings correctly, in greek
If I add
<%@ page language = "java" contentType = "text/html; charset=UTF-8" pageEncoding = "UTF-8"%>
at the top of my page, it show as UTF-8 but my data is not displayed correctly. Any ideas what's the problem?