sms-counter-php icon indicating copy to clipboard operation
sms-counter-php copied to clipboard

Normalize Newline Characters for SMS Count

Open ba5liel opened this issue 2 years ago • 0 comments

  • Standardize newline characters to \n across 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 count function to replace \r\n with \n.
  • Ensured that the modified count function 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.

ba5liel avatar Jan 10 '24 16:01 ba5liel