Weird problem with preg_replace and chinese character

请求翻译

i have this werid problem. After a preg_replace, some chinese character became funky character. this is the script.

$message = strip_tags(mysql_real_escape_string($_POST['message']),'');
echo $message;
$message = removewhitespace($message);
echo $message;

function removewhitespace($a)
{
return preg_replace('/(\\\r\\\n\\\r\\\n)+/','\r\n\r\n', preg_replace('/^(\\\r\\\n)+|(\\\r\\\n)+$/', '', preg_replace('/\s+/', ' ', preg_replace('/^\s+|\s+$/', '', $a))));
}

The display would be

好不好你
好不好?

Any ideas?

3个回答