I need to search some rows from database by its title. Problem is with czech diacritics: in phpMyAdmin in row title is shown this:
Černé kouřovody 2MM
in php, where I call searching query default string is written like this:
Černé kouřovody 2MM
And I don't know, how to find out rows with this ( Černé kouřovody 2MM ) title by this( ÄŒerné kouÅ™ovody 2MM ) title
Here is my query on database:
SELECT * FROM categories WHERE LOWER(title) LIKE LOWER("Černé kouřovody 2MM") COLLATE utf8_bin
Thank you very much for your help
There are multiple variants to solve this. Personally, I use base64 encoding . I encode it before insertion to db, and then I decode upon extraction from DB. You can avoid that by setting appropriate collation in your database, for example, czech collation.
If you use base64, you can use any character without worrying about collation, but it results in some data overhead. I'd use it.
Those 2 should be ok, cause I gotta run now :P
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.