Skip to main content

SMS Character Counter

Project description

SMS Counter

python-sms-counter is a lib that help to count characters of SMS messages.

How to use it

from sms.counter import SMSCounter
>>> counter = SMSCounter ();
>>> counter.count ( 'ǂ some-string-to-be-counted' ).dict ();
>>> {'length': 29, 'messages': 1, 'remaining': 41, 'per_message': 70, 'encoding': 'UTF16'}
>>> {'chars_per_segment': 70,
     'chars_remaining': 43,
     'content': 'ǂ some-string-to-be-counted',
     'encoding': 'UTF16',
     'max_chars_available': 70,
     'segment': 1,
     'sms_size': 27}

The meaning of the sms_size, chars_remaining and chars_per_segment values returned by count() depend on the encoding.

For GSM_7BIT_EX encoding, sms_size, chars_remaining and chars_per_segment 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 sms_size of the message '€' is 2, because it takes 2 7bit characters to encode '€' in GSM_7BIT_EX.

For UTF16 and GSM_7BIT encoding, sms_size, chars_remaining and chars_per_segment count the number of characters (since all characters have an equal bit width).

All GSM_7BIT & GSM_7BIT_EX characters list : https://en.wikipedia.org/wiki/GSM_03.38

Mentions

License

MIT licensed. See the bundled LICENSE file for more details.

Support

  • Python : >=3.9

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sms_counter-0.0.1.tar.gz (4.8 kB view details)

Uploaded Source

File details

Details for the file sms_counter-0.0.1.tar.gz.

File metadata

  • Download URL: sms_counter-0.0.1.tar.gz
  • Upload date:
  • Size: 4.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.13.5

File hashes

Hashes for sms_counter-0.0.1.tar.gz
Algorithm Hash digest
SHA256 0b897b146113c65183d8053f277b993cc7c56112fa62a0c0c7095d10d6722098
MD5 f25cb300a5f7cf53e52d764bf9655fe7
BLAKE2b-256 215762cf7141a371d6008f3802c7cbcf73d9e67b7b68b3f32064c549bcfc650f

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page