Hey guy, Need your urgent help, I got some text in mysql , that text contains very strange symbol which creates me problems in xml. I can not even copy&paste that symbol into browser, browser can not see it, so I decide to make a picture of it. Look at the symbol in front of Director How to remove it ? I try preg_replace with preg_replace("/[^A-Za-z0-9]/","",$out); still doesnt go away, tried some other , nothing helps.
assuming $str = "*Director" remove the first character from $str with the following: $str = substr($str, 1, (strlen($str) - 1)); Code (markup):
It looks like the unicode character that represents the female gender (U+2640 ). Pass the $out variable to the function below. It strips most of the unwanted Unicode characters. function strip_symbols( $text ) { $plus = '\+\x{FE62}\x{FF0B}\x{208A}\x{207A}'; $minus = '\x{2012}\x{208B}\x{207B}'; $units = '\\x{00B0}\x{2103}\x{2109}\\x{23CD}'; $units .= '\\x{32CC}-\\x{32CE}'; $units .= '\\x{3300}-\\x{3357}'; $units .= '\\x{3371}-\\x{33DF}'; $units .= '\\x{33FF}'; $ideo = '\\x{2E80}-\\x{2EF3}'; $ideo .= '\\x{2F00}-\\x{2FD5}'; $ideo .= '\\x{2FF0}-\\x{2FFB}'; $ideo .= '\\x{3037}-\\x{303F}'; $ideo .= '\\x{3190}-\\x{319F}'; $ideo .= '\\x{31C0}-\\x{31CF}'; $ideo .= '\\x{32C0}-\\x{32CB}'; $ideo .= '\\x{3358}-\\x{3370}'; $ideo .= '\\x{33E0}-\\x{33FE}'; $ideo .= '\\x{A490}-\\x{A4C6}'; return preg_replace( array( // Remove modifier and private use symbols. '/[\p{Sk}\p{Co}]/u', // Remove mathematics symbols except + - = ~ and fraction slash '/\p{Sm}(?<![' . $plus . $minus . '=~\x{2044}])/u', // Remove + - if space before, no number or currency after '/((?<= )|^)[' . $plus . $minus . ']+((?![\p{N}\p{Sc}])|$)/u', // Remove = if space before '/((?<= )|^)=+/u', // Remove + - = ~ if space after '/[' . $plus . $minus . '=~]+((?= )|$)/u', // Remove other symbols except units and ideograph parts '/\p{So}(?<![' . $units . $ideo . '])/u', // Remove consecutive white space '/ +/', ), ' ', $text ); } PHP: Source :http://nadeausoftware.com/articles/2007/09/php_tip_how_strip_symbol_characters_web_page