You are reading a single comment by @MaBe and its replies. Click here to read the full conversation.
  • 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

    Wow - many thanks

    code on Puck:

    transfer = function (saJS5) {
            var aJS5;
            try {
                aJS5 = eval('('+saJS5+')');
                print("aJS5:",aJS5);
            } catch(e){
                console.log("error in eval:",e);
            }
    };
    
    

    I tried this:

    transfer
    COMMAND: transfer(""{txt:'012345\\nabcde\\näöüß'}­"")  // <- using extra " is the issue
    
    Noble: stateChange -> poweredOn
    Found:  Puck.js f5b9
    BT> Connecting
    BT> Connected
    Received "<- Serial1\r\n>"
    write: transfer(""{txt:'012345\\nabcde\\näöüß'}­"")   
    
    Received "Uncaught SyntaxError"
    Received ": Got '{' expected '"
    Received ",'\r\n at line 1 col 1"
    Received "2\r\ntransfer(\"\"{txt:'"
    Received "012345\\\\nabcde\\\\n ?["
    Received "228] ?[246] ?[252] ?"
    Received "[223]'}\"\")\r\n        "
    Received "                    "
    Received "       ^\r\n>"
    Disconnected
    

    removing the extra " and it works fine

    COMMAND: transfer("{txt:'012345\\nabcde\\näöüß'}"­)
    
    Noble: stateChange -> poweredOn
    Found:  Puck.js f5b9
    BT> Connecting
    BT> Connected
    Received "<- Serial1\r\n>"
    write: transfer("{txt:'012345\\nabcde\\näöüß'}"­)
    
    Received "aJS5: { \r\n  \"txt\": \""
    Received "012345\\nabcde\\n\\xE4\\"
    Received "xF6\\xFC\\xDF\"\r\n }\r\n>"
    Disconnected
    
About

Avatar for MaBe @MaBe started