Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

message content will read/write as Buffer

  • Loading branch information...
commit 7f59307b3c8fcc14607f464f13f7ba26d7507b5a 1 parent 75e7988
kaven276 authored
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/Commands.js
8 lib/Commands.js
View
@@ -82,9 +82,8 @@ Msg.prototype.makePDU = function(reqPDU){
} else {
// for attr that length is determined by its instance length, not by its type's fixed length
// for example MessageContent attr in Submit PDU
- bytesWriten = PDU.write(val, sPtr); // me[attrs[i - 1].name], Encodings[me.MessageCoding]);
- // console.log('----', bytesWriten, val, sPtr, PDU.length);
- sPtr += bytesWriten;
+ bytesWriten = val.copy(PDU, sPtr);
+ sPtr += val.length;
}
})(attr.length);
break;
@@ -174,7 +173,8 @@ Msg.parse = function(data){
ptr += attr.length;
} else {
varLen = msg[PDUAttrSeq[i - 1].name];
- val = data.toString('utf8', ptr, ptr + varLen); // todo: encoding may not be utf8
+ // val = data.toString('utf8', ptr, ptr + varLen); // todo: encoding may not be utf8
+ val = new Buffer(data.slice(ptr, ptr + varLen));
// console.log('varLen', varLen, aname, val);
ptr += varLen;
}
Please sign in to comment.
Something went wrong with that request. Please try again.