diff --git a/Mf2/Parser.php b/Mf2/Parser.php index c7cc02d..518efbd 100644 --- a/Mf2/Parser.php +++ b/Mf2/Parser.php @@ -111,10 +111,7 @@ function collapseWhitespace($str) { } function unicodeTrim($str) { - // this is cheating. TODO: find a better way if this causes any problems - $str = str_replace(mb_convert_encoding(' ', 'UTF-8', 'HTML-ENTITIES'), ' ', $str); - $str = preg_replace('/^\s+/', '', $str); - return preg_replace('/\s+$/', '', $str); + return preg_replace('/^\s+|\s+$/u', '', $str); } /**