Please put Chinese related problems here. 我勒个去啊,我现在都不知道该怎么新建一个我想要添加的内容,你说我得肿么办呢?
@楼上的人: 只需要访问网址:http://jamwiki.org/wiki/en/Special:Edit?topic={你的标题},就行了
This section is to show a bug.
Previously, I thought I found this bug, then it works fine, then it happens again, in fact, it seems that it has nothing to do with chinese, it is about the search engine, and virtual wiki, so I created another page lucene
I just found a bug, if the topic is in Chinese, then the article can not be searched. For example, this article with a topic in Chinese, then the content of this article can not be found by search.
Please search the phrase "JAMWiki in Chinese" or the word "JAMWikiinchinese", 汉字
You will see that you can not find them.
It is weird, in my server, the search engine can not find it, but here, yes, the search engine does find it.
I went to search my own wiki again, I search some English, then I search Chinese characters, it works now. Previously, when I never search English word, it doesn't show me anything when I search Chinese characters.
I am sorry that I can not reproduce the phenomenon.
....
After install the completely new release 0.9.1, chinese charater is not more good. When I create a new topic with chinese name(2 characters), it seems to be OK. It is OK even with search.
But if I refresh the page, then the topic can not be found with message:
The requested value "?" was invalid. It may contain one or more characters which cannot be used in titles.
I check database jam_topic table. The topic name, page name, page name lower are all '??'.
But the problem is not at the db side, since I can mannualy change the topic name to chinese. then access the topic from wiki, it is OK, though the content is still '??'
So the problem is located in somewhere when the information was transferred to db. but where is it?
Another thing, even my display name which is in chinese, before refresh, it is ok. after refresh it becomes '???', I checked database, it is '???'.
where is the log, I mean I just want to check the jdbc log to find out what is passed to the database. for the database url, do we have to set ?useUnicode=true
this one doesn't change the result.
AnsiQueryHandler.insertTopic(Topic topic, int virtualWikiId, Connection conn) throws SQLException
{
..........
stmt.setInt(index++, virtualWikiId);
System.out.println("topicName:"+topic.getName());
stmt.setString(index++, topic.getName());
............
}
I mean before it was inserted into Database, is it right? and the print out is good. so what might be the problem? The connection properties?
By the way, my own java program write some chinese to DB is good. jack 14-Aug-2010 23:53 PDT
After I changed the datasource in DatabaseConnection.java
private synchronized static void configDataSource() throws SQLException
{
if (dataSource != null)
{
closeConnectionPool(); // DataSource has already been created so remove it
}
String url = Environment.getValue(Environment.PROP_DB_URL);
System.out.println(url);
DataSource targetDataSource = null;
if (url.startsWith("jdbc:"))
{
try
{
// Use an internal "LocalDataSource" configured from the Environment
//targetDataSource = new LocalDataSource();
InitialContext ctx;
Context envCtx;
ctx = new InitialContext();
envCtx = (Context) ctx.lookup("java:comp/env");
String sDSN="db4all";
targetDataSource = (DataSource)envCtx.lookup(sDSN);
Connection con=targetDataSource.getConnection();
Statement stm=con.createStatement();
String sql="insert into info_itemname values(5,'zh_CN','蕉')";
System.out.println(sql);
int iret=stm.executeUpdate(sql);
System.out.println(iret);
stm.close();
con.close();
Then the above test statement is good, and the whole wiki is good with chinese character(I mean I checked jam_topic table). While I define the data source in context.xml as follows.
<Resource auth="Container" name="db4all" type="javax.sql.DataSource"
maxActive="100" maxIdle="-1" maxWait="10000"
driverClassName="com.mysql.jdbc.Driver"
username="xxx" password="xxxx"
url="jdbc:mysql://127.0.0.1:3307/alanfruitsdb?useUnicode=true&characterEncoding=UTF-8&characterSetResults=UTF-8&autoReconnect=true"/>