var jsesc = require('jsesc'); console.log(jsesc('foo 𝌆 bar'));