---
title: "Format.htmlspecialchars ViewHelper <f:format.htmlspecialchars>"
manual: "Fluid Explained"
version: "main"
permalink: "https://docs.typo3.org/permalink/fluid:typo3fluid-fluid-format-htmlspecialchars"
source: "ViewHelpers/Fluid/Format/Htmlspecialchars.rst"
rendered: "2026-10-08T14:12:40+00:00"
---

# Format.htmlspecialchars ViewHelper `<f:format.htmlspecialchars>` {#typo3fluid-fluid-format-htmlspecialchars}

> [!NOTE]
> This reference is part of the documentation of Fluid Standalone.
> If you are working with Fluid in TYPO3 CMS, please refer to
> [TYPO3's ViewHelper reference](https://docs.typo3.org/other/typo3/view-helper-reference/14.3/en-us/Global/Format/Htmlspecialchars.html) instead.

Applies PHP `htmlspecialchars()` escaping to a value.

See [http://www.php.net/manual/function.htmlspecialchars.php](http://www.php.net/manual/function.htmlspecialchars.php)

## Examples {#examples}

### Default notation {#default-notation}

```php
<f:format.htmlspecialchars>{text}</f:format.htmlspecialchars>

```

Output:

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

```

### Inline notation {#inline-notation}

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

```

Output:

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

Go to the source code of this ViewHelper: [Format\\HtmlspecialcharsViewHelper.php (GitHub)](https://github.com/TYPO3/Fluid/blob/main/src/ViewHelpers/Format/HtmlspecialcharsViewHelper.php).

**Arguments**

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

-   **doubleEncode**

    -   *Type:* boolean
    -   *Default:* true

    If false, html entities will not be encoded

-   **encoding**

    -   *Type:* string
    -   *Default:* 'UTF-8'

    Encoding

-   **keepQuotes**

    -   *Type:* boolean
    -   *Default:* false

    If true quotes will not be replaced (ENT_NOQUOTES)

-   **value**

    -   *Type:* string

    Value to format
