From 4f9cd45d2194618adc96798caae5b3381f9629a8 Mon Sep 17 00:00:00 2001 From: Jan Iwanow Date: Wed, 15 Jul 2020 19:02:25 +0700 Subject: [PATCH] fixed #10 by providing support for the multibyte strings --- composer.json | 1 + src/SmppService.php | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/composer.json b/composer.json index f1e6998..2bf31a8 100644 --- a/composer.json +++ b/composer.json @@ -9,6 +9,7 @@ } ], "require": { + "ext-mbstring": "*", "php-smpp/php-smpp": "1.2", "illuminate/support": "^5|^6|^7" }, diff --git a/src/SmppService.php b/src/SmppService.php index f0a3309..b44dfe7 100644 --- a/src/SmppService.php +++ b/src/SmppService.php @@ -224,7 +224,7 @@ protected function getSmppAddress($phone = null) */ protected function sendSms(SmppAddress $sender, $recipient, $message) { - $message = iconv('UTF-8', 'UCS-2', $message); + $message = mb_convert_encoding($message, 'UCS-2', 'utf8'); return $this->smpp->sendSMS($sender, $this->getRecipient($recipient), $message, null, SMPP::DATA_CODING_UCS2); }