PHP搜索字符串包含特殊字符和外来字母

I have a very simpel search function which search for a product name in a mysql database.

When i'm searching for any product using A-Z the functions is working fine.

However, i have a product with the name "product & nämë".

When searching for this product i get 0 results - even though im searching for the exact name of the product.

The problem i have, i believe, is because of the characters 'ö ä ë &'.

What is the best practice allowing me to search for products with these characters.

My code is as following: The search query:

$search_string = preg_replace("/[^ \w]+/", "", $_GET["find"]);
$query_products_category_id = 'WHERE product_name LIKE "%'. $search_string .'%"';
  • I also tried using the regular expression for using letters A-Z allowing the '&' character but then i had a problem with the special letters.

If you could just point me to a function or another approach it would be much appreciated.