Skip to main content

Escape HTML

Escapes special characters in a string to their corresponding HTML entities.

Common Properties

  • Name - The custom name of the node.
  • Color - The custom color of the node.
  • Delay Before (sec) - Waits in seconds before executing the node.
  • Delay After (sec) - Waits in seconds after executing node.
  • Continue On Error - Automation will continue regardless of any error. The default value is false.
info

If the ContinueOnError property is true, no error is caught when the project is executed, even if a Catch node is used.

Inputs

  • Escape String - The input string to escape HTML entities.

Options

This node does not have any options.

Output

  • Escaped - The string with special HTML characters converted to entities.

How It Works

The Escape HTML node converts special characters in a string to their corresponding HTML entities to prevent them from being interpreted as HTML markup. When executed, the node:

  1. Retrieves the Escape String input variable
  2. Validates that the string is not empty
  3. Uses the html.EscapeString function to convert special characters:
    • < becomes <
    • > becomes >
    • & becomes &
    • " becomes "
    • ' becomes '
  4. Sets the escaped string as the output variable

Requirements

  • A non-empty string input to escape

Error Handling

The node will return specific errors in the following cases:

  • Empty or invalid Escape String input - "Escape String can not be empty"

Usage Notes

  • Useful for sanitizing user input before displaying in HTML contexts
  • Prevents cross-site scripting (XSS) vulnerabilities by escaping potentially harmful characters
  • The escaped string can be safely embedded in HTML documents without being interpreted as markup
  • Commonly used when displaying user-generated content in web applications
  • The reverse operation (converting entities back to characters) can be performed with the Unescape HTML node
  • Does not modify characters that don't have special meaning in HTML
  • The output string will be longer than the input if special characters were present