How to handle search query with Japanese language

2019-04-16 10:21发布

I use MySQL Server for Web App JSP, and have a problem with LIKE query in MySQL. When i use LIKE query with Katakana type of Japanese language, sometime results don't display correctly.

Example:

SELECT  r.report_id, r.user_id, u.user_name
FROM report r JOIN user u ON u.user_id = r.user_id
WHERE r.report_comment LIKE CONCAT('%', 'AC', '%') )

In this query, when i type 'AC' character with English, and try to execute this query with Java. Results is correct(1 row returned).

enter image description here

But when i type 'AC' character with Katakana, and try to execute this query with Java. No rows are found. enter image description here

How to handle search query correctly with all of case?

1条回答
狗以群分
2楼-- · 2019-04-16 11:06

The MySQL CJK faq contains various tips about how to deal with Japanese character. The paragraph Make sure that the problem is not with the browser or other application, rather than with MySQL seems to provide fix to your issue.

查看更多
登录 后发表回答