shorty icon indicating copy to clipboard operation
shorty copied to clipboard

Client: automatically detect charset and convert and split sms by charset with overlenght to concat sms

Open Dexus opened this issue 11 years ago • 3 comments

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

Dexus avatar Nov 13 '13 23:11 Dexus

unicode (ucs-2[be] / UTF-16BE) is not direct possible with node... need build a converter with iconv or simlar

Dexus avatar Nov 14 '13 14:11 Dexus

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

eugenehp avatar Nov 20 '13 03:11 eugenehp

I don't think shorty will provide such conversion, it belongs to the shorty consumer scope

Xerkus avatar Sep 10 '16 14:09 Xerkus