Hey all, On some of my websites I have a function that clears all special chars from a string. What it does it leaves only 0-9a-zA-Z, and replaces all white spaces with '-'. Here it is: $string = preg_replace('/[^\-0-9a-zA-Z\/]/', '', str_replace(' ', '-', $string)); Code (markup): The problem is, the strings come from a DataBase, where they are stored in UTF8. Some strings contain special chars that I want to be replaced and not removed. For example: "â" and "ă" to be replaced with "a", "ş" with "s" respectively. I played around with it for a long time, but I wasn't able to figure this problem out. Can somebody help me out? Rep will be given
if you enable the mbstring and mbregex, you can use the ereg_ functions with regular expressions and UTF-8 strings. preg_ functions are not ever UTF-8 enabled as far as i'm aware ...