Skip to content

Main content

Decoding: ECMAScript Unicode Code Point Escape Tool

Decode one ECMAScript braced Unicode code-point escape restricted to Unicode scalar values, rejecting surrogates and out-of-range values rather than accepting ill-formed text.

Loading tool…

Description

Decode one braced scalar escape to a code point and character.

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.

Decode one braced scalar escape to a code point and character.

When to use this tool

Use Decoding: ECMAScript Unicode Code Point Escape 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.

Decode one braced scalar escape to a code point and character. Require literal backslash-u braces with 1-6 hexadecimal digits and a valid Unicode scalar; return codepoint and String.fromCodePoint result.1

Unicode scalar values exclude surrogate code points. Code units, scalar values and encoded byte sequences are distinct representations.2

Input fieldMeaning and unitsAccepted input
tokenBraced Unicode escape restricted here to Unicode scalar values; surrogate escapes accepted in some ECMAScript contexts are rejected.Required. 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.codepointNumeric Unicode code point; distinguish code points from UTF-16 code units.Calculated result member: number.
result.characterCharacterCalculated result member: string.
json
{
  "input": {
    "token": "\\u{1F600}"
  },
  "output": {
    "result": {
      "codepoint": 128512,
      "character": "😀"
    }
  }
}

Limitations and assumptions

  • This rejects surrogate escapes allowed in some JavaScript source contexts and does not execute code.
  • 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/ecmascript-unicode-code-point-escape — tool.io

  2. Unicode 17.0: conformance and encoding forms — Unicode Consortium

Similar or alternative tools