Skip to content

Main content

Decoding: Html Numeric Reference Token Tool

Parse one terminated numeric character reference, retaining radix and invalid-Unicode-scalar evidence; no HTML replacement table or document parsing.

Loading tool…

Description

Parse a restricted terminated HTML numeric reference and flag scalar validity.

Unicode code points, UTF-16 units and UTF-8 octets are different representations. A local escape or byte check can report useful structure without establishing that an entire encoded string is well formed.

Parse a restricted terminated HTML numeric reference and flag scalar validity.

When to use this tool

Use Decoding: Html Numeric Reference Token when inspecting the stated scalar, escape or byte-layout component.

How to use the tool and how it works

  1. Enter token. Use the units and conventions below.
  2. Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
  3. Read result. Expand result to inspect the returned fields.

Parse a restricted terminated HTML numeric reference and flag scalar validity. Accept 1-8 decimal or 1-6 hexadecimal digits; return radix, numeric codepoint and whether it is <= U+10FFFF outside the surrogate interval.1

Input fieldMeaning and unitsAccepted input
tokenTokenRequired. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units.
Output fieldInterpretationReturned shape
resultReturned object; expand its named members below.Required. Object.
result.radixRadixCalculated result member: number.
result.codepointNumeric Unicode code point; distinguish code points from UTF-16 code units.Calculated result member: number.
result.validUnicodeScalarWhether the parsed value is at most U+10FFFF and outside the surrogate range; no HTML replacement/remapping is performed.Calculated result member: boolean.
json
{
  "input": {
    "token": "&#xD800;"
  },
  "output": {
    "result": {
      "radix": 16,
      "codepoint": 55296,
      "validUnicodeScalar": false
    }
  }
}

Limitations and assumptions

  • Invalid scalars are returned with a false flag; HTML replacement/remapping rules and whole-document parsing are not applied.
  • Outputs are nested inside result. Inputs must satisfy both the field types and the cross-field conditions above. Invalid input causes an error; a successful false flag or documented placeholder is a different result.

Alternative or Complementary methods

Use a conforming complete decoder for strings and distinguish Unicode scalar validity from source-language or HTML error recovery.

References

  1. Calculation and input contract: decode/html-numeric-reference-token — tool.io

Similar or alternative tools