About the JavaScript Unescape
Copy a string out of minified code, a stack trace or a debugger watch window and it arrives full of backslashes. This tool resolves them: the short forms \n, \r, \t, \b, \f and \v, the hex form \xNN, the four-digit \uXXXX, and the code-point form \u{1F30A} that ES2015 added for characters outside the basic plane.
Anything else after a backslash is an identity escape and simply loses the backslash, which is exactly what the language does: \" gives a quote, \/ gives a slash, and \q gives a q. A backslash at the very end of a line is a line continuation and disappears along with the newline. If a matching pair of quotes or backticks wraps the whole input they are removed for you, unless you tick the option to keep them.
Two cases stop the conversion rather than guess. A truncated hex escape such as \u12 is reported with its position, and \0 followed by a digit is flagged because that is a legacy octal escape which strict-mode JavaScript rejects. Java uses a different escape set, so Java Unescape handles octal and the doubled-u form instead.
How to use
- Paste the escaped string, with or without its quotes.
- Read the decoded text on the right and copy it.
- If the quotes are part of your data, tick Keep surrounding quotes before copying.
Common questions
- Does it handle \u{1F600} style escapes?
- Yes. Braced code-point escapes up to U+10FFFF are decoded into the real character.
- Why does \q become just q?
- JavaScript treats an unknown escape as the character itself, so the backslash is dropped. This tool copies that behaviour instead of raising an error.
- Are the outer quotes removed automatically?
- Only when the same quote character opens and closes the whole input. Otherwise the text is left untouched.
- What if an escape is incomplete?
- You get an error naming the position and how many hex digits were expected, so nothing is silently mangled.