odysseus

Values

pub fn unescape(escaped: String) -> String

Unescapes a string by converting HTML entities back to their original characters.

JavaScript

Browser (main target)

In the browser, this function uses the DOMParser to parse the string as HTML and extract the text content, this means all HTML entities will be converted back to their original characters exhaustively.

Node.js/Deno/Bun

In Node.js, Deno, or Bun, this function will convert:

  • > to >
  • &lt; to <
  • &quot; to "
  • &apos; to '
  • &amp; to &
  • &copy; to ©
  • &reg; to ®
  • &euro; to
  • &pound; to £
  • &cent; to ¢
  • &deg; to °
  • &bull; to
  • &middot; to ·
  • &ndash; to
  • &mdash; to
  • &lsquo; to '
  • &rsquo; to '
  • &sbquo; to
  • &bdquo; to
  • &hellip; to
  • &trade; to
  • &nbsp; to a non-breaking space character.

Erlang

On the BEAM, this function will convert:

  • &gt; to >
  • &lt; to <
  • &quot; to "
  • &apos; to '
  • &amp; to &
  • &ldquo; to "
  • &rdquo; to "
  • &copy; to ©
  • &reg; to ®
  • &euro; to
  • &pound; to £
  • &cent; to ¢
  • &deg; to °
  • &bull; to
  • &middot; to ·
  • &ndash; to
  • &mdash; to
  • &lsquo; to '
  • &rsquo; to '
  • &sbquo; to
  • &bdquo; to
  • &hellip; to
  • &trade; to
  • &nbsp; to a non-breaking space character.

If you need to unescape a string that contains other HTML entities, please create an issue!

Search Document