I have the following piece of code which seems to be changing my character set.
$html = "à";
echo $html; // result: à
$html = preg_replace("/\s/", "", $html);
echo $html; // result: ?
However, when I use [\t\n\r\f\v]
as my pattern instead of the special character \s
it works fine:
$html = "à";
echo $html; // result: à
$html = preg_replace("/[\t\n\r\f\v]/", "", $html);
echo $html; // result: à
Why is that?