Data Converter icon

Data Converter

Convert between various data formats - Base64, Binary, JSON, XML, YAML, CSV, HTML, and more

Overview

The node performs various data encoding and decoding operations, including HTML entity encoding and decoding. Specifically, for the Encoding > HTML Encode operation, it converts special characters in a text string into their corresponding HTML entities. This is useful to safely display user input or other text content on web pages without risking HTML injection or rendering issues.

Common scenarios include:

  • Preparing user-generated content for safe insertion into HTML.
  • Encoding special characters like <, >, &, ", and ' so they appear correctly in browsers.
  • Preventing cross-site scripting (XSS) vulnerabilities by escaping HTML entities.

Example:
Input: Tom & Jerry <3 "fun"
Output: Tom &amp; Jerry &lt;3 &quot;fun&quot;

Properties

Name Meaning
Input Data The text string to encode as HTML entities.
Binary Property Name (Optional) Name of the binary property for output if binary output is enabled (not used here).

Output

The node outputs a JSON object with a field named result containing the HTML-encoded string.

Example output JSON:

{
  "result": "Tom &amp; Jerry &lt;3 &quot;fun&quot;"
}

No binary output is produced for this operation.

Dependencies

  • No external services or API keys are required.
  • Uses internal utility functions for HTML encoding.
  • No special environment variables or n8n configurations needed.

Troubleshooting

  • Empty input: If the input string is empty, the output will also be an empty string.
  • Invalid input type: The node expects a string input. Providing non-string types may cause unexpected results or errors.
  • Unexpected characters: Some rare Unicode characters might not have HTML entity equivalents and will remain unchanged.
  • Error handling: If an error occurs during processing, the node will throw an error unless configured to continue on failure.

Links and References

Discussion