RevealTheme logo

Codificatore e decodificatore di entità HTML

Converte i caratteri speciali in entità HTML (&, <, ecc.) e viceversa. Utile per incorporare testo in HTML in modo sicuro.

Come usare questo strumento

  1. 1

    Pick a mode with the Encode or Decode toggle at the top.

  2. 2

    Paste or type your text into the input box.

  3. 3

    Read the converted result in the output panel below, which updates as you type.

  4. 4

    Select and copy the output to use in your HTML or document.

Che cos'è il codificatore e decodificatore di entità HTML?

Le entità HTML sono sequenze di escape che rappresentano caratteri con un significato speciale in HTML: &amp; per &, &lt; per <, ecc. Se incorpora testo fornito dall'utente direttamente in HTML senza codificarlo, crea vulnerabilità XSS. Questo strumento converte il testo in HTML con entità codificate per incorporarlo in modo sicuro, oppure decodifica l'HTML con entità riportandolo a testo semplice.

Casi d'uso comuni

  • Pasting a code snippet into a blog post or docs so tags like <div> display literally instead of rendering.

  • Escaping user-supplied text before dropping it into an HTML template to avoid breaking the markup.

  • Decoding entity-laden strings copied from page source, RSS feeds, or scraped HTML back into readable text.

  • Turning a stray &amp;nbsp; or &amp;mdash; from a CMS export back into a normal space or em dash.

  • Preparing example strings for tutorials where you need to show the raw entity form of a character.

  • Quickly checking what &#39; or &#x2014; decodes to without writing throwaway code.

Domande frequenti

Quali caratteri devo codificare?
Come minimo: < > & " '. Hanno un significato speciale in HTML e possono compromettere l'analisi o creare XSS.
Devo codificare tutte le entità o solo quelle non sicure?
Per le pagine UTF-8 moderne, codifichi solo quelle non sicure (&, <, >, ", '). Codificare tutto appesantisce inutilmente l'HTML.

Strumenti correlati