Skip to content
This repository has been archived by the owner on Nov 1, 2022. It is now read-only.

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

Open
Dexus opened this issue Nov 13, 2013 · 3 comments

Comments

@Dexus
Copy link

Dexus commented Nov 13, 2013

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:
apihard@791e1b1

@Dexus
Copy link
Author

Dexus commented Nov 14, 2013

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

@eugenehp
Copy link

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

@Xerkus
Copy link
Contributor

Xerkus commented Sep 10, 2016

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

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants