Skip to content

Encode HTML

Vali (naser) Rafinia edited this page Mar 27, 2023 · 2 revisions

The nhash encode html command provides the ability to encode and decode HTML text.

Usage

nhash encode html <text> [options]

Arguments

  • <text>: Text to be encoded or decoded.

Options

  • -d, --decode: If this option is provided, the input text is expected to be HTML-encoded and will be decoded instead of being encoded.
  • -o, --output <output>: If this option is provided, the output will be written to the specified file.
  • -?, -h, --help: Show help and usage information.

Examples

  1. Encoding HTML
nhash encode html "<h1>Hello World</h1>"

Output:

&lt;h1&gt;Hello World&lt;/h1&gt;
  1. Decoding HTML
nhash encode html -d "&lt;h1&gt;Hello World&lt;/h1&gt;"

Output:

<h1>Hello World</h1>
  1. Writing output to a file
nhash encode html --output encoded.html "<h1>Hello World</h1>"

The encoded output will be written to a file named encoded.html.

Note

This command can be useful when encoding or decoding HTML entities, such as when working with web development or when needing to pass HTML-encoded data in URLs or other contexts.

Clone this wiki locally