michaelwittig / node-q

Q interfacing with Node.js
MIT License
52 stars 14 forks source link

Space decoded to "null" #15

Closed iuhh closed 8 years ago

iuhh commented 8 years ago

Hey Michael,

Found the new commit decodes spaces in string to nulls, as it's done char by char this renders the output incorrectly, one would end up with a string "null" in place of " ".

function rChar() {

c58528c@michaelwittigsupport for nulls, infinity and guid michaelwittig authored 14 days ago 54 var val = rInt8(); 55 if (val === 32) { 56 return null; 57 } else { 58 return String.fromCharCode(val); 59 }

Perhaps there was a rationale to add this in earlier? In any case I'd say the old behaviour is correct.

Thanks Hui

michaelwittig commented 8 years ago

Hi Hui, the emptyChar2null option since v1.0.1 will do what you expect.

var nodeq = require("node-q");
nodeq.connect({host: "localhost", port: 5000, emptyChar2null: false}, function(err, con) {
    if (err) throw err;
    console.log("connected");
    // interact with con like demonstrated below
});

The reason for changing the behaviour in vrsion 1.0.0 is explained here: https://github.com/michaelwittig/node-q/issues/13#issuecomment-139116626