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: HtmlspecialcharsViewHelper.php (GitHub).

Arguments

The following arguments are available for <f:format.htmlspecialchars>:

Name Type Default
string
boolean
string 'UTF-8'
boolean true
value
Type
string

Value to format

keepQuotes
Type
boolean

If TRUE quotes will not be replaced (ENT_NOQUOTES)

encoding
Type
string
Default
'UTF-8'

Encoding

doubleEncode
Type
boolean
Default
true

If FALSE html entities will not be encoded