sms-counter-php
sms-counter-php copied to clipboard
Normalize Newline Characters for SMS Count
- Standardize newline characters to
\nacross different platforms. - Improve SMS character count accuracy.
Overview
This PR introduces a small but crucial change to the count function in the SMS counting logic. It normalizes newline characters across different operating systems by converting all \r\n (Carriage Return + Line Feed) to \n (Line Feed). This change ensures that the SMS character count is consistent and accurate regardless of the platform the text is coming from.
Changes Made
- Added a line in the
countfunction to replace\r\nwith\n. - Ensured that the modified
countfunction accurately reflects the length of the text for SMS counting.
Impact
- This change ensures consistency in SMS character counting across different platforms (Windows, Unix/Linux).
- It addresses the issue where newline characters were counted differently in different operating systems, leading to discrepancies in SMS part calculations.
Tests and Safety
- This change has been tested locally to ensure that the SMS count remains accurate and consistent.
- The modification is minimal and contained, reducing the risk of any unforeseen impacts on the rest of the system.