{
    "slug": "html-and-xml-entity-encoder-decoder",
    "name": "HTML and XML Entity Encoder Decoder",
    "url": "https://directory.milunir.com/developer-tools/encoders-decoders/html-and-xml-entity-encoder-decoder/",
    "description": "Escape markup into character references such as &lt; and &amp;, or decode &copy;, &#169; and &#x20AC; back to symbols, with HTML or strict XML rules.",
    "inputs": {
        "type": "object",
        "properties": {
            "text": {
                "type": "string",
                "description": "Text or markup"
            },
            "direction": {
                "type": "string",
                "enum": [
                    "encode",
                    "decode"
                ],
                "description": "Direction",
                "default": "encode"
            },
            "flavor": {
                "type": "string",
                "enum": [
                    "html",
                    "xml"
                ],
                "description": "Rules",
                "default": "html"
            },
            "non_ascii": {
                "type": "boolean",
                "description": "Also encode non-ASCII characters (é, €, emoji). Useful when the page or feed may be read with the wrong character set.",
                "default": false
            }
        },
        "additionalProperties": false,
        "required": [
            "text"
        ]
    },
    "outputs": [
        {
            "key": "primary",
            "label": "Result"
        },
        {
            "key": "entities",
            "label": "References converted"
        },
        {
            "key": "length_change",
            "label": "Length change (characters)"
        },
        {
            "key": "distinct",
            "label": "Different references"
        }
    ],
    "modes": null,
    "feed": null,
    "endpoint": "https://api.tools-directory.workers.dev/v1/tools/html-and-xml-entity-encoder-decoder",
    "mcp_tool": "html_and_xml_entity_encoder_decoder",
    "example": {
        "inputs": {
            "text": "<a href=\"x\">Tom & Jerry</a>",
            "direction": "encode",
            "flavor": "html"
        },
        "output": "Result: &lt;a href=&quot;x&quot;&gt;Tom &amp; Jerry&lt;/a&gt;\nReferences converted: 7\nLength change (characters): 26"
    }
}