Commit 3fe1e25b authored by Fabien Potencier's avatar Fabien Potencier

merged branch GromNaN/patch-2 (PR #287)

Commits
-------

0676cd2a Use the application charset as default charset for `$app->escape()` method.

Discussion
----------

Use the application charset as default charset for $app->escape() method

---------------------------------------------------------------------------

by igorw at 2012-03-21T11:47:47Z

👍

I'm curious, are you using something other than UTF-8?

---------------------------------------------------------------------------

by GromNaN at 2012-03-21T12:04:21Z

@igorw The database is encoded in ISO-8859-15. With this patch, I'll only have to change the app charset once the database converted to UTF-8.
parents 5eac61f3 0676cd2a
......@@ -344,9 +344,9 @@ class Application extends \Pimple implements HttpKernelInterface, EventSubscribe
*
* @return string Escaped text
*/
public function escape($text, $flags = ENT_COMPAT, $charset = 'UTF-8', $doubleEncode = true)
public function escape($text, $flags = ENT_COMPAT, $charset = null, $doubleEncode = true)
{
return htmlspecialchars($text, $flags, $charset, $doubleEncode);
return htmlspecialchars($text, $flags, $charset ?: $this['charset'], $doubleEncode);
}
/**
......
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