question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Missing escape/unescape ?

See original GitHub issue

TypeScript Version:

1.8 Code

var a = escape("&#");
var b = unescape(a);

Expected behavior: no error

Actual behavior: can not find name ‘escape’ can not find name ‘unescape’

by the way, typescript playground experience is terrible when use Microsoft Edge (input chinese charactors , click a new line , select code)

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:4
  • Comments:14 (12 by maintainers)

github_iconTop GitHub Comments

44reactions
mhegazycommented, May 17, 2016

The global escape and unescape are deprecated, please use encodeURI instead. see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/escape.

If you want to use them, just add the definitions:

declare function escape(s:string): string;
4reactions
RReversercommented, Dec 28, 2017

@mhegazy @RyanCavanaugh escape / unescape are useful exactly because they don’t support UTF-8. decodeURIComponent(escape(s)) and unescape(encodeURIComponent(s)) are, even if imperfect, very common and established “patterns” to decode / encode UTF-8 across all browsers including pretty ancient ones.

Read more comments on GitHub >

github_iconTop Results From Across the Web

unescape() - JavaScript - MDN Web Docs
The unescape() function computes a new string in which hexadecimal escape sequences are replaced with the characters that they represent.
Read more >
How to unescape escaped characters from the regex (.*?)
1. The string is ok. It just outputs it with the \f as some sort of hidden char. · String.raw maybe? – Konrad...
Read more >
8. Escape/Unescape special XML characters - XMLStarlet
xml esc --help XMLStarlet Toolkit: Escape special XML characters Usage: xml ... more to be added in future) if <string> is missing stdin...
Read more >
unescape() - JavaScript - UDN Web Docs: MDN Backup
The unescape() function computes a new string in which hexadecimal escape sequences are replaced with the character that it represents. The escape sequences ......
Read more >
Slash-unescape a String
Load a string, unescape a string. ... It then removes the backslash, expands the escape sequence to its raw value and returns to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found