Commit a46df6a3 authored by Fabien Potencier's avatar Fabien Potencier

added charset as a parameter

parent 7426d53a
...@@ -263,3 +263,7 @@ Core parameters ...@@ -263,3 +263,7 @@ Core parameters
debug mode. debug mode.
Defaults to false. Defaults to false.
* **charset** (optional): The charset to use for Responses.
Defaults to UTF-8.
...@@ -96,6 +96,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe ...@@ -96,6 +96,7 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
$this['request.http_port'] = 80; $this['request.http_port'] = 80;
$this['request.https_port'] = 443; $this['request.https_port'] = 443;
$this['debug'] = false; $this['debug'] = false;
$this['charset'] = 'UTF-8';
} }
/** /**
......
...@@ -28,7 +28,12 @@ class TwigExtension implements ExtensionInterface ...@@ -28,7 +28,12 @@ class TwigExtension implements ExtensionInterface
public function register(Application $app) public function register(Application $app)
{ {
$app['twig'] = $app->share(function () use ($app) { $app['twig'] = $app->share(function () use ($app) {
$twig = new \Twig_Environment($app['twig.loader'], isset($app['twig.options']) ? $app['twig.options'] : array()); $app['twig.options'] = array_replace(
array('charset' => $app['charset']),
isset($app['twig.options']) ? $app['twig.options'] : array()
);
$twig = new \Twig_Environment($app['twig.loader'], $app['twig.options']);
$twig->addGlobal('app', $app); $twig->addGlobal('app', $app);
if (isset($app['symfony_bridges'])) { if (isset($app['symfony_bridges'])) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment