I've read many posts that explain how to deal with Unicode characters, but none of the suggestions are working for me.
My php page reads a file that contains strings with high-order characters, e.g., "Mötor". I want to convert the strings to "normal" characters, e.g., "Motor".
This is what I have tried:
$source = "Mötor";
$test = preg_replace('/[^\w\d\p{L}]/u', "", $source); // Returns null.
$test = preg_replace('/[^\w\d\p{L}]/u', "", htmlentities($source)); // Returns "".
$test = preg_replace("/&([a-z])[a-z]+;/i", "$1", $source); // Returns "Mötor".
$test = preg_replace("/&([a-z])[a-z]+;/i", "$1", htmlentities($source)); // Returns "".
$test = iconv('utf-8', 'ascii//TRANSLIT', $source); // Returns false.
I am stumped. Thanks!
This is called "transliteration" and intl's Transliterator will work far better than bodging together regular expressions.
Output: