Fixed problem with UCS2 encoded long messages

This commit is contained in:
2015-06-13 17:56:08 +02:00
parent 7c1f7ef485
commit c5a4b93aee
4 changed files with 115 additions and 19 deletions
+9 -2
View File
@@ -2,7 +2,8 @@
// More or less copied from https://github.com/farhadi/node-smpp
var iconv = require('iconv-lite'),
var log = require('winston'),
iconv = require('iconv-lite'),
encodings = {},
filters = {},
tlvsById = {},
@@ -135,7 +136,13 @@ types = {
},
write: function(value, buffer, offset) {
value = value || 0;
buffer.writeUInt8(value, offset);
try {
buffer.writeUInt8(value, offset);
} catch (err) {
log.error('larvitsmpp: lib/defs.js - Could not write integer value "' + value + '" on offset "' + offset + '" when buffer length is "' + buffer.length + '"');
throw err;
}
},
size: function() {
return 1;