Yes, I know I should be using UTF-8, but I need to use windows-1252 charset encoding.
I know I can do it by hardcoding the base Synfony response class
Response.php,
$charset = $this->charset ?: 'windows-1252';
but that's ugly as hell.
I can't find where to set it from the config files. Any help?
You can change charset in the middleware:
<?php namespace App\Http\Middleware;
use Closure;
class SetCharset
{
public function handle($request, Closure $next)
{
$response = $next($request);
$response->header('Content-Type', 'text/html; charset=windows-1252');
return $response;
}
}
Just make sure that all the content you return is in proper encoding.