Updated default character escaping for UTF-8 compatibility. For other character sets, or to disable UTF-8 support entirely, change the 'charset' property or renderEscaped method on subclasses.
This commit is contained in:
+4
-1
@@ -22,6 +22,9 @@ class Mustache {
|
|||||||
protected $throwPartialExceptions = false;
|
protected $throwPartialExceptions = false;
|
||||||
protected $throwVariableExceptions = false;
|
protected $throwVariableExceptions = false;
|
||||||
|
|
||||||
|
// Override charset passed to htmlentities() and htmlspecialchars(). Defaults to UTF-8.
|
||||||
|
protected $charset = 'UTF-8';
|
||||||
|
|
||||||
protected $tagRegEx;
|
protected $tagRegEx;
|
||||||
|
|
||||||
protected $template = '';
|
protected $template = '';
|
||||||
@@ -232,7 +235,7 @@ class Mustache {
|
|||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
protected function renderEscaped($tag_name, &$context) {
|
protected function renderEscaped($tag_name, &$context) {
|
||||||
return htmlentities($this->getVariable($tag_name, $context));
|
return htmlentities($this->getVariable($tag_name, $context), null, $this->charset);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user