var aJS5 = {txt : "012345\nabcde\näöüß"};
var saJS5 = E.toJS(aJS5);
//"{txt:\"012345\\nabcde\\n\\xE4\\xF6\\xFC\\xDF\"}"
var sa2JS5 = E.toJS(saJS5);
// "{txt:\"012345\\nabcde\\n\\xE4\\xF6\\xFC\\xDF\"}" // same
var COMMAND = `transfer(${sa2JS5})\n`;
// note I took the first 2 control chars out
eval(COMMAND); // this work as-is
// Exact code copied from your example that you say doesn't work
transfer("{txt:\"012345\\nabcde\\n\\xE4\\xF6\\xFC\\xDF\"}") // works fine
>print(COMMAND);
transfer("{txt:\"012345\\nabcde\\n\\xE4\\xF6\\xFC\\xDF\"}")
=undefined
//copy and paste
>transfer("{txt:\"012345\\nabcde\\n\\xE4\\xF6\\xFC\\xDF\"}") // also works fine
in the emulator
So I don't really see what the problem is here?
I guess there is maybe some problem with how you are sending this? It seems to me from your replace of \ with \\ that somehow you're trying to evaluate/parse the string one more times than was intended
Espruino is a JavaScript interpreter for low-power Microcontrollers. This site is both a support community for Espruino and a place to share what you are working on.
I just tried:
in the emulator
So I don't really see what the problem is here?
I guess there is maybe some problem with how you are sending this? It seems to me from your replace of
\
with\\
that somehow you're trying to evaluate/parse the string one more times than was intended