PREG_REPLACE Codificación
$html = preg_replace("/\s/u", "", $html);
Fantastic Ferret
$html = preg_replace("/\s/u", "", $html);