Crayl
Crayl

Reputation: 1911

MySQL - How to use SELECT to get only special characters in UTF8

I'am trying to SELECT a cloumn in the table which contains only vowels. It works fine till I try to select entries with german umlauts (special chars like ä,ö,ü), then the query makes no difference between u<->ü, o<->ö, a<->ä

SELECT vowels 
FROM words
WHERE vowels LIKE 'ü'
// this also selects all entries with simple 'u'

Collation of the database is UTF8, document is formatted in UTF8, I'am using $mysqli->set_charset("utf8");

Any ideas how to get that working? Thanks!

Upvotes: 0

Views: 724

Answers (2)

dockeryZ
dockeryZ

Reputation: 3981

you can use COLLATE to change the collation on the fly

SELECT vowels COLLATE utf8_bin as vowel
FROM words
WHERE vowel LIKE 'ü'

not tested

Upvotes: 1

goat
goat

Reputation: 31813

one way is to use the utf8_bin collation.

Upvotes: 2

Related Questions