From 9f82f8d9c8107c12a1f90a7b76069c71342aea20 Mon Sep 17 00:00:00 2001 From: basliel Date: Wed, 10 Jan 2024 19:10:21 +0300 Subject: [PATCH] Normalize Newline Characters for SMS Count - Standardize newline characters to `\n` across different platforms. - Improve SMS character count accuracy. --- SMSCounter.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/SMSCounter.php b/SMSCounter.php index 983bec7..11cee5a 100644 --- a/SMSCounter.php +++ b/SMSCounter.php @@ -182,6 +182,10 @@ public function getAddedPortugueseGsm7bitExMap() */ public function count($text) { + //Implemented normalization of newline characters in the SMS count function to ensure consistent and accurate SMS length calculations across different platforms. + //This fix standardizes the handling of newlines by converting `\r\n` to `\n`, addressing the issue where SMS parts were calculated differently due to varying newline character lengths in different operating systems. + + $text = str_replace("\r\n", "\n", $message) return $this->doCount($text, false); }