0

My database features names with special characters e.g. Sigur Rós

The problem is that if you search for the name with regular characters e.g. "Sigur Ros", no results will be returned.

What's the best way to handle this? Is there a tool which I can use, or would I have to find and replace these manually with PHP?

fxfuture
  • 1,910
  • 3
  • 26
  • 40

1 Answers1

1

In your database, if you set the collation on the column that contains this data to utf8_unicode_ci, then the sorting and comparisons will ignore accents.

  • Thanks but doesn't work. I checked the database and it's stored as "Sigur Rós" – fxfuture Mar 29 '14 at 06:37
  • 1
    HTML entities in the database will limit your options severely. I suggest you write a script to convert the relevant fields to UTF-8 using PHP's html_entity_decode() function. Then make sure that any code which updates the table also calls that function to clean up new data before inserting it in the table. Once you've done that, then the collation settings should work. – Todd Phillips Mar 29 '14 at 22:11
  • Thanks Todd, works beautifully – fxfuture Apr 05 '14 at 01:36