here are the settings
this time using odbc connection
![showing u the settings][1]
[1]: http://i.stack.imgur.com/4f2bD.jpg
and
![ i have mentioned utf8 here][1]
[1]: http://i.stack.imgur.com/C9fo5.jpg
here is my code
<%--
Document : index.jsp
Created on : 30 Aug, 2011, 10:57:05 AM
Author : Sahil
--%>
<%@page contentType="text/html" pageEncoding="UTF-8" import = "java.sql.*;"%>
<%@page import = "java.util.*"%>
<%@ page import = "java.io.*"%>
<%@page import= "java.lang.RuntimePermission" %>
<!DOCTYPE html>
<html>
<head>
<title>Punjabi-Hindi Dictionary | Output</title>
<link href="style.css" rel="stylesheet" type="text/css" media="screen" />
</head>
<body>
<form accept-charset="UTF-8">
<%
try
{
if (request.getCharacterEncoding() == null)
request.setCharacterEncoding("UTF-8");
Connection cn;
Statement st;
ResultSet rs;
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
cn=DriverManager.getConnection("jdbc:odbc:myodbc","root","");
st=cn.createStatement();
rs=st.executeQuery("select * from stu_info");
while(rs.next()){
String Name= rs.getString("Name");
%>
<%=Name%>
<br>
<%
}
rs.close();
st.close();
cn.close();
}
catch(Exception ex)
{
out.println(ex.getMessage());
}
%>
</form>
</body>
</html>
this time it gives me diffrent output
साहिल
साहिलसाहिल
相关问题
- sqlyog export query result as csv
- NOT DISTINCT query in mySQL
- MySQL: conduct a basic search
- Why sometimes there is one of more gap(s) in the v
- mySQL alter table on update, current timestamp
Obviously your output is in a single page encoding (e.g. ISO-8859-1) and not in UTF-8, this can have several reasons:
Is your database connection properly set up to use UTF-8? I don't know how this is done for odbc, but for the mysql-jdbc Driver you might need to append this to your configuration url:
characterEncoding=utf-8