Im running this query:
SELECT id FROM posts WHERE title LIKE '%CERTIFIED INSTALLER%';
The text in the database is stored as ‘ᴄᴇʀᴛɪꜰɪᴇᴅ ɪɴꜱᴛᴀʟʟᴇʀꜱ’ which is of a unique font.
The above query returns 0 results, but whenever I change ‘ᴄᴇʀᴛɪꜰɪᴇᴅ ɪɴꜱᴛᴀʟʟᴇʀꜱ’ text font in the database to something like san-serif it returns the results.
Why is this?
2
Answers
It isn’t a different font, but a different character in Unicode.
If you paste the text into https://www.babelstone.co.uk/Unicode/whatisit.html, you’ll see it informs you of what the characters actually are:
Taking the "ᴄ" as an example, you can look it up elsewhere, such as at https://symbl.cc/en/1D04/, which informs us that:
Whereas you can see a standard capital C is actually a different character in Unicode, referred to as "Latin Letter Capital C", https://symbl.cc/en/0043/:
It also means that your database (and table) uses a character set that supports the Unicode characters you’ve shown here.
When a search is performed using the
LIKE
operator, the database compares the characters in the search string with the characters in the column data. However, character encoding and collation settings determine how the comparison is done.You can specify a collation for your query to ensure proper character comparison. Here’s an example of how you can modify your query to use a specific collation:
*** Adjust the collation according to your database’s character encoding and collation settings.