$string = htmlentities($content, null, 'utf-8'); $content = str_replace(" ", "", $string); $content = html_entity_decode($content);