页面显示“?",而不是“é" [英] Page displaying '?', instead of 'é'
问题描述
我正在从oracle11g中检索数据并在IE8和IE9浏览器上显示数据,但是无法显示某些特殊字符(例如é)
I am retriving data from oracle11g and displaying the data on IE8 and IE9 browser, but the couldn't display some special characters (eg. é)
在我的网页中,我明确声明了'UTF-8'编码.
In my webpage, I have explicitly declare 'UTF-8' encoding.
对于我的tomcat Web服务器,server.xml
For my tomcat webserver, the server.xml
<Connector port="8080" protocol="HTTP/1.1"
connectionTimeout="20000"
redirectPort="8443" URIEncoding="UTF-8" useBodyEncodingForURI="true"/>
我阅读了堆栈流中的其他一些问题,他们提到这些问题也是为了确保数据库连接也使用'UTF-8'.
I read some other questions in stackflow, they mentioned to also ensure the database connection is using 'UTF-8' too.
<Resource name="jdbc/AppDB"
auth="Container"
type="javax.sql.DataSource"
maxActive="20" maxIdle="10" maxWait="10000"
username="foo"
password="bar"
driverClassName="com.mysql.jdbc.Driver" url="jdbc:mysql://localhost:3306/ ID_development?useEncoding=true&characterEncoding=UTF-8"
/>
给出的解决方案是针对mysql的. 如果我使用oracleDriver,如何设置编码?
The solution given is for mysql. How can i set the encoding if im using oracleDriver?
<Resource name="jdbc/AppDB"
auth="Container"
type="javax.sql.DataSource"
driverClassName="oracle.jdbc.OracleDriver"
url="jdbc:oracle:thin:@127.0.0.1:1521:ora11"
username="foo"
password="bar"
maxActive="20"
maxIdle="1000"
maxWait="-1" />
推荐答案
请查看此答案.无论它专注于SQL Developer,还是包含有关调优JDBC驱动程序的信息,并指出如何在Oracle中正确处理Unicode字符类型.
Please review this answer. Regardless of fact that it's focused on SQL Developer, it contains information about tuning JDBC driver and points out how to properly handle unicode character types in Oracle.
更新
在客户端上显示字符的麻烦可能是由于数据库客户端(在本例中为Tomcat)上错误的NLS_LANG
设置引起的.对于从Java语言环境设置派生的瘦JDBC驱动程序NLS_LANG值.
对于可能的变体,您可以查看此问题上的答案并检查 Oracle文档.
如果问题的真正根源在于Oracle数据库连接的字符集,则只有两个可能的端点需要检查:NLS_LANG
和oracle.jdbc.defaultNChar
.因此,您需要检查两者的设置是否正确以找出发生了什么情况.
Update
Troubles with displaying characters on the client may be caused by wrong NLS_LANG
settings on the database client (Tomcat in your case). For thin JDBC driver NLS_LANG value derived from java locale settings.
For possible variants you can look through the answers on this question and check Oracle documentation.
If a real source of the problem lies to character set of Oracle database connection, then there are only two possible end points to check: NLS_LANG
and oracle.jdbc.defaultNChar
. So you need to examine if both set properly to figure out what is happened.
这篇关于页面显示“?",而不是“é"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!