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
साहिल
साहिलसाहिल
-2
A
回答
-1
显然你的输出是一个单页编码(如ISO-8859-1),而不是UTF-8,这可能有几个原因:
- 你检查过的数据是否正确存储在你的数据库中?如果不是,则应检查用于存储数据的表是否为UTF-8
数据库连接是否正确设置为使用UTF-8?我不知道这是ODBC完成,但为MySQL-JDBC驱动程序可能需要附加给你的配置URL:
的characterEncoding = UTF-8
+0
是的,我检查了我的数据被正确存储。 –
+0
你可以在评论中提示我。 –
+0
我已经做到了这一点...但再次不工作 –
相关问题
- 1. 字符串变量无法获得值
- 2. 无法打印字符*字符串
- 3. 连接字符串无效
- 4. MSXML:无效类字符串
- 5. “无效”iphone字符串
- 6. 字符串包含无效字符?
- 7. Base64字符串中无效的ViewState /无效字符
- 8. 打印字符串的所有变种最有效的方法?
- 9. Data :: FormValidator为无效数据打印hashref而不是字符串
- 10. Lua中字符串的打印地址
- 11. String.format打印地址,而不是可变长度字符串
- 12. R:无效的多字节字符串
- 13. 如何使用变音符打印到文件的字符串?
- 14. 加载字符串数组中字符串的有效地址?
- 15. 打印在MIPS字符串和可变
- 16. 带变量的Awk打印字符串
- 17. java打印字符串变量
- 18. 我不能得到fread()将文件内容打印到字符串变量
- 19. 连接/打印字符串文字
- 20. 如何获得字符串[地图<字符串,字符串>的]
- 21. Mongoose:utils.populate:无效的路径。预期的字符串。得到typeof'undefined'
- 22. 高效地分割字符串
- 23. 无法打印(char *)OpenGL字符串
- 24. golang无法打印内部字符串
- 25. 无法在C++中打印字符串
- 26. 将变量的名称打印为字符串,或将变量链接到字符串变量以“打印”
- 27. 从字符串“SystemNullReferenceException:O”到字符串“Integer”的转换无效
- 28. 获得“InvalidCharacterError:字符串包含无效字符”在列表框中
- 29. 打印字符串
- 30. 无效字符
我不知道为什么我不能看到图像 –
我已经使用列数据类型varchar(50)和排序规则是utf8_general_ci –
可能的重复[Getting ??????而不是使用JSP的MySQL数据库的印地文文本](http://stackoverflow.com/questions/7318757/getting-instead-of-hindi-text-from-mysql-database-using-jsp) – BalusC