Search code examples
mysqlunicode

How to handle umlauts in a MySQL `WHERE` clause?


My Table collation is utf8_general_ci and character set is utf8. If I run a query like the following, it does not show me any value.

SELECT * FROM mytable WHERE myfield = "Björn Borg"
OR myfield = "FrüFrü & Tigerlily";

So how I can fetch the values from table ?


Solution

  • The problem can be in your connection charset. Try to run

    SET NAMES 'utf8mb4'
    

    And then your query.