message_segment_calculator library

The SMS Segment Calculator package.

This package provides tools to calculate the number of SMS segments required for messages, supporting both GSM-7 and UCS-2 encoding standards, and the billing of RCS messages.

Classes

RcsSegment
One billable part of an RCS message.
RcsSegmentedMessage
============================================================================= CLASS: RcsSegmentedMessage PURPOSE: Calculates how an RCS message is billed. RCS text is UTF-8, so sizes are counted in bytes rather than GSM-7 / UCS-2 characters.
SegmentedMessage
============================================================================= CLASS: SegmentedMessage PURPOSE: Manages the segmentation and encoding of SMS messages based on specified encoding formats. It supports encoding into GSM-7 and UCS-2 character sets and can handle different line break styles.

Enums

LineBreakStyle
============================================================================= ENUM: LineBreakStyle PURPOSE: Defines different styles for line breaks in text messages.
RcsMessageType
How an RCS message is billed.
RcsRegion
Region an RCS message is billed in.
SmsEncoding
============================================================================= ENUM: SmsEncoding PURPOSE: Specifies the encoding types for a SMS messages.
SmsEncodingMode
============================================================================= ENUM: SmsEncodingMode PURPOSE: Specifies the encoding types that can be used for SMS messages.

Constants

rcsSegmentCapacityBytes → const int
Size of one billable RCS segment, in UTF-8 bytes.
rcsSingleCapacityBytes → const int
Largest RCS message billed as a single message outside the US, in UTF-8 bytes.
smartEncodingMap → const Map<String, String>
A map that replaces common Unicode characters with their GSM-7 compatible equivalents.
unicodeToGsm → const Map<int, List<int>>
A mapping of Unicode characters to their GSM-7 equivalents.

Functions

countUtf8Bytes(String message) → int
Number of bytes message takes when encoded as UTF-8.