0

Just from a browser developer console or Node.js repl, what's an easy way to transcribe a string as its unicode representation? For example I can input '\u0048\u0065\u006C\u006C\u006F' and the repl will show me 'Hello'

> '\u0048\u0065\u006C\u006C\u006F'
"Hello"

How can I reverse this?

> something('Hello')
"\u0048\u0065\u006C\u006C\u006F"

For example. I hope there are some convenient built-ins or browser console/repl support.

theonlygusti
  • 11,032
  • 11
  • 64
  • 119
  • I not sure it is possible. In JS `"\u0048\u0065\u006C\u006C\u006F" === "Hello" // true` so they're equivalent. --- Unless the backslashes are escaped, maybe? – evolutionxbox Jun 12 '21 at 12:52
  • Would this solve your issue [How to reverse String.fromCharCode?](https://stackoverflow.com/questions/2071602/how-to-reverse-string-fromcharcode) – Ant Jun 12 '21 at 12:54
  • 2
    @Ant I think this question is the opposite of that one. – evolutionxbox Jun 12 '21 at 12:57

0 Answers0