Articles in this section

htmlEncode helper

Converts special characters in a string (such as <, >, &, ', ") into their encoded entity forms. Use it when you need to safely store or transmit text that may include reserved characters.

Usage

{{{htmlEncode value}}}
  • value (required): input string to encode

Examples

  1. Encode HTML-sensitive characters

    {{htmlEncode record.content}}
    

    Input:

    {
      "record": {
        "content": "<div class='alert'>& Goodbye \"world\"</div>"
      }
    }
    

    Output:

    &lt;div class=&#39;alert&#39;&gt;&amp; Goodbye &quot;world&quot;&lt;/div&gt;
    

Tip

  • Use this helper when sending data that should not be interpreted as markup, such as embedding text inside HTML templates or storing raw text in databases.

  • Only special characters are converted; plain text remains unchanged.

  • Combine with htmlDecode if you need to safely switch between encoded and decoded forms.