Skip to content

Instantly share code, notes, and snippets.

@5a494d
Created October 2, 2017 19:32
Show Gist options
  • Save 5a494d/7b23748254e9ddada2b592b44f83ab72 to your computer and use it in GitHub Desktop.
Save 5a494d/7b23748254e9ddada2b592b44f83ab72 to your computer and use it in GitHub Desktop.
Escape Characters
var source = '\x53\x6f\x72\x72\x79\x21\x20You\x72 \x6be\x79\x20\x66\x69l\x65\x20\x69s i\x6eva\x6ci\x64\x2e';
var decoded = source.replace(/\\x([a-f0-9][a-f0-9])/g, function(a,b) {
return String.fromCharCode(parseInt(b, 16));
});
document.write(decoded);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment