I am a bit stuck and need some help :)
I have a MySQL table that consists of 1 column that uses UTF8mb4_general_ci as collation. This column contains lots of names in many different languages.
| name |
|-----------------|
| François Fillon |
| Obama |
| Some CJK chars |
I also have a PHP array with lots of names in it. Ex.
["Francois Fillon" => [...], "Obama" => [...]]
I want to run each of these names against the DB and check for each name's existence. If we run this statement:
SELECT * FROM `kwe` WHERE `phrase` = "Francois Fillon" OR `phrase` = "Obama"
it will yield the following result:
| François Fillon |
| Obama |
NOTE: This is because the ç in the table and the c in the array are equivalent due to the *_general_ci scheme in MySQL. This is great because my user might end up using a regular c when he in fact meant to use the ç.
The problem I am trying to solve here is that once these results are returned to the application layer, they need to be merged back into the original array which contains the name in its user entered form. And in PHP, " François Fillon != Francois Fillon ".
How should I go about solving this?
Edit (clarification):
User enters "Francois Fillon" and that gets saved into the array --> MySQL matches that to "François Fillon" and returns the result --> $array["François Fillon"] will not exist in array