onlinecity / php-smpp

PHP 5 based SMPP client library
232 stars 160 forks source link

How to send UTF-8 messages? #84

Closed ruturajpatki closed 5 years ago

ruturajpatki commented 5 years ago

I am able to send English Text messages with this Class; but not able to send Chinese, Hindi UTF-8 Unicode messages with this class. Scrambled text is received. Please guide me to use this class for sending UTF-8 messages.

spChief commented 5 years ago

After evening of experiments I found solution: First, encode message in UCS-2BE: $encodedMessage = iconv('utf-8', "UCS-2BE", $message); Second, set encoding to SMPP::DATA_CODING_UCS2 $smpp->sendSMS($from, $to, $encodedMessage, null, SMPP::DATA_CODING_UCS2) This code works for me (I send cyrillic messages), but then I fall out to other problem - long messages split to several standalone messages.

ruturajpatki commented 5 years ago

@spChief ... yes, I did the same thing and it worked for me too!