开发者

Cannot select Unicode data from PostgreSQL with LIKE

I have a PostgreSQL database with some Unicode values. For example "vaishali" in Marathi. I want to fire a query SELECT * FROM table WHERE name LIKE vaishali (I type "vaishali" in Marathi, 开发者_开发技巧so I first convert to unicode in my prog). But it matches nothing. Why?


There are two possible causes for this problem:

  1. The JDBC driver is not instructed to use UTF-8. This would actually be a bug, because it's supposed to automatically pickup the correct character encoding from the DB metadata. To my experience, the PostgreSQL JDBC drivers have always done a good job in this.

  2. The SQL query is actually wrongly constructed/formulated. The one which you've posted is already syntactically invalid. Please post the actual code and query. Also, you seem to insist that it only happens with a LIKE query. How about a normal WHERE name = 'foo' query?

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜