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
- Enter token. Use the units and conventions below.
- Run the tool. Correct any format, range, or cross-field input error before interpreting the output.
- 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 field | Meaning and units | Accepted input |
|---|---|---|
| token | Token | Required. Text. Implementation limit: 8192 Unicode code points and 16384 UTF-16 code units. |
| Output field | Interpretation | Returned shape |
|---|---|---|
| result | Returned object; expand its named members below. | Required. Object. |
| result.radix | Radix | Calculated result member: number. |
| result.codepoint | Numeric Unicode code point; distinguish code points from UTF-16 code units. | Calculated result member: number. |
| result.validUnicodeScalar | Whether the parsed value is at most U+10FFFF and outside the surrogate range; no HTML replacement/remapping is performed. | Calculated result member: boolean. |
{
"input": {
"token": "�"
},
"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
Similar or alternative tools
- Decoding: ECMAScript Unicode Code Point Escape
Decode one braced scalar escape to a code point and character.
- Unicode Escape Braced Digit Budget
Parse one braced Unicode escape and its written digit count.