Open Dexus opened 11 years ago
unicode (ucs-2[be] / UTF-16BE) is not direct possible with node... need build a converter with iconv or simlar
Here is some snippet for you:
var Iconv = require('iconv').Iconv;
var toucs = new Iconv('UTF-8', 'UCS-2BE');
and you convert it like so:
message = toucs.convert(message);
Don't forget to install dependencies first:
npm install iconv
There also another library you may want to try:
iconv-lite
I don't think shorty will provide such conversion, it belongs to the shorty consumer scope
my idee is that the client should automatically convert the charset (ie UTF-8 with only GSM 03.38 chars) to GSM 03.38 or if need (Unicode with other chars as in GSM 03.38) to USC2 charset.
If the message lenght is longer than 160/70(USC2) than split to messages with 153/63 chars.
with header support like in php-smpp https://github.com/onlinecity/php-smpp/blob/master/smppclient.class.php#L280
CSMS_8BIT_UDH = 153 chars in concat mode CSMS_16BIT_TAGS = 152 chars in concat mode CSMS_PAYLOAD = for me unknown; not possible to test with my partners
some encodings in smpp (5.0) https://github.com/farhadi/node-smpp/blob/master/lib/defs.js#L227
example like: https://github.com/pshon/shorty/commit/791e1b11257794e61b9c1683c489ed6530acb82d