php - Compressed HTML in Laravel still contains whitespace -



php - Compressed HTML in Laravel still contains whitespace -

i using below code compress html output in laravel; set in filters/app::after function

if (app::environment() != 'local') { if ($response instanceof illuminate\http\response) { $output = $response->getoriginalcontent(); // clean comments $output = preg_replace('/<!--([^\[|(<!)].*)/', '', $output); $output = preg_replace('/(?<!\s)\/\/\s*[^\r\n]*/', '', $output); // clean whitespace $output = preg_replace('/\s{2,}/', '', $output); $output = preg_replace('/(\r?\n)/', '', $output); $response->setcontent($output); } }

but character "à" symbol: � instead. tried remove line:

$output = preg_replace('/\s{2,}/', '', $output);

it fixed symbol error, html output not work (some white space not removed). can help me?

php laravel-4

Comments

Popular posts from this blog

c - Compilation of a code: unkown type name string -

java - Bypassing "final local variable defined in an enclosing type" -

json - Hibernate and Jackson (java.lang.IllegalStateException: Cannot call sendError() after the response has been committed) -