开发者

MySQL difficulties - Hiragana and Katakana are treated as the same

开发者 https://www.devze.com 2023-03-28 09:17 出处:网络
I tried to fetch ピース on mysql database SELECT * FROM edict WHERE japanese = \'ピース\' However I got 3 results which are:

I tried to fetch ピース on mysql database SELECT * FROM edict WHERE japanese = 'ピース' However I got 3 results which are: ヒース ビーズ ピース

I tried to use ぴーす as the query and it also return the same result. SELECT * FROM edict WHERE japanese = 'ぴーす'

How can I solve this problem?

开发者_如何学GoThank you


I'm not sure about japanese alphabets, but you could use BINARY comparison:

WHERE BINARY japanese = 'ピース'

BINARY keyword casts string to its binary presentation, thus you have "precise" comparison.

Also, if that behaviour should be default for japanese column - you could change its collation to _bin one (it will be more efficient solution, rather than just casting)

0

精彩评论

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