Format.htmlspecialchars ViewHelper <f:format.htmlspecialchars>

Applies PHP htmlspecialchars() escaping to a value.

See http://www.php.net/manual/function.htmlspecialchars.php

Examples

Default notation

<f:format.htmlspecialchars>{text}</f:format.htmlspecialchars>
Copied!

Output:

Text with & " ' < > * replaced by HTML entities (htmlspecialchars applied).
Copied!

Inline notation

{text -> f:format.htmlspecialchars(encoding: 'ISO-8859-1')}
Copied!

Output:

Text with & " ' < > * replaced by HTML entities (htmlspecialchars applied).
Copied!

Source code

Go to the source code of this ViewHelper: Format\HtmlspecialcharsViewHelper.php (GitHub).

Arguments

The following arguments are available for the format.htmlspecialchars ViewHelper:

doubleEncode

doubleEncode
Type
boolean
Default
true
If false, html entities will not be encoded

encoding

encoding
Type
string
Default
'UTF-8'
Encoding

keepQuotes

keepQuotes
Type
boolean
Default
false
If true quotes will not be replaced (ENT_NOQUOTES)

value

value
Type
string
Value to format