Updating README to clarify counting

This commit is contained in:
Zachary Lovelady 2020-08-27 17:14:29 -06:00
parent c3722c8618
commit 40ef757ed1

View File

@ -25,6 +25,12 @@ from sms_counter import SMSCounter
>>> {'length': 29, 'messages': 1, 'remaining': 41, 'per_message': 70, 'encoding': 'UTF16'} >>> {'length': 29, 'messages': 1, 'remaining': 41, 'per_message': 70, 'encoding': 'UTF16'}
``` ```
The meaning of the `length`, `remaining` and `per_message` values returned by `SMSCounter.count()` depend on the encoding.
For GSM_7BIT_EX encoding, `length`, `remaining` and `per_message` count the number of 7-bit characters in the message, __including__ the escape character that must precede any characters in the "extended" character set. For example, the `length` of the message '€' is 2, because it takes 2 7bit characters to encode '€' in GSM_7BIT_EX.
For UTF16 and GSM_7BIT encoding, `length`, `remaining` and `per_message` count the number of characters (since all characters have an equal bit width).
#### Mentions #### Mentions
* Original idea : [danxexe/sms-counter](https://github.com/danxexe/sms-counter) * Original idea : [danxexe/sms-counter](https://github.com/danxexe/sms-counter)