Caution: This documentation is for eZ Publish legacy, from version 3.x to 5.x.
For 5.x documentation covering Platform see eZ Documentation Center, for difference between legacy and Platform see 5.x Architecture overview.



Returns an HTML-safe version of the input string.


input|wash( [type] )


type string The type of text that should be washed. No.


An HTML-safe version of the input string.


This operator translates the input string into an HTML friendly version. It will take care of converting bogus characters to HTML-friendly replacements. The "type" parameter can be used to specify the washing type, it can be set to either "xhtml" or "email" (the default is "xhtml"). E-mail washing can be controlled using the setting of the [WashSettings] configuration block of "template.ini". All strings that may break the HTML should always be washed using this operator.


Example 1

{'Bogus & stuff <'|wash()}
The following output will be produced: "Bogus & stuff <".

Example 2

{''|wash( 'email' )}

The following output will be produced:

hello<span class="spamfilter">SPAMFILTER</span>

Example 3

{''|wash( 'email' )}

If a configuration override for "template.ini" exists and contains...



...the following output will be produced: "hello[at]example[dot]com".

Balazs Halasy (05/02/2004 11:02 am)

Geir Arne Waaler (23/04/2010 7:39 am)

Balazs Halasy, Geir Arne Waaler


  • Additional parameters "javascript" & "pdf"

    The wash operator will also take "javascript" & "pdf" as parameter
  • Wash only & quotes < > signs with htmlspecialchars

    Can you tell me why the wash function uses htmlspecialchars php function instead of htmlentities php function in order to wash ALL the bogus characters for a good HTML result ?
  • wash your quotes

    If you wash a xmltext attribute like this

    and it contains quotes, it seems to transforms &quot; into &amp;quot; ...