mathiasbynens / jsesc

Given some data, jsesc returns the shortest possible stringified & ASCII-safe representation of that data.
https://mths.be/jsesc
MIT License
716 stars 53 forks source link

How to revert back escaped string #24

Closed bcalik closed 8 years ago

bcalik commented 8 years ago

Is there any way to revert back the escaped string?

michaelficarra commented 8 years ago

eval?

bcalik commented 8 years ago

Sorry I am really not a javascript guy. Could you please give an example? I could not do it.

michaelficarra commented 8 years ago
eval(x)
bcalik commented 8 years ago

eval gives me an error.

This one solved my issue, thank you anyway:

var decodedString = JSON.parse("\""+encodedString+"\"").toString();