i have mysql table stores information songs , artists. on client side, have web page uses jquery , ajax search through data, in form of auto complete. example, typing 'david b' give david bowie. works fine, when wants search 'mötley crüe' have type special characters before returns in search results. want users able type 'motley c' , auto completed 'mötley crüe'.
currently build select query , use '%pattern%' search artists. there way in mysql?
thank you!
this works out of box if store artist's name unicode-aware , culture independent collation, such utf8_general_ci
. can change collation of column alter table
:
alter table yourtable modify artistname varchar(255) collate utf8_general_ci;
if can't/don't want change column collation can use specific collation in query this:
select * yourtable artistname 'motley%' collate utf8_general_ci;
Comments
Post a Comment