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.0.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

sms_counter-0.0.0-py3-none-any.whl (5.1 kB view details)

Uploaded Python 3

File details

Details for the file sms-counter-0.0.0.tar.gz.

File metadata

  • Download URL: sms-counter-0.0.0.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.2

File hashes

Hashes for sms-counter-0.0.0.tar.gz
Algorithm Hash digest
SHA256 adb804e85cdf6f7953009f13eeb7d0eadd80b6d33e03a7f8ebee54f7d7fb9bbf
MD5 a5f6f17378d72c9e43df2ca49e7f86e5
BLAKE2b-256 1a483087000be7487d1c67937b8d3a74d80124147ac0bbf46b360b1b69d1a08d

See more details on using hashes here.

File details

Details for the file sms_counter-0.0.0-py3-none-any.whl.

File metadata

  • Download URL: sms_counter-0.0.0-py3-none-any.whl
  • Upload date:
  • Size: 5.1 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.9.2

File hashes

Hashes for sms_counter-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 199364b9840a035dfb3afff9a2919f2492ed3bd73a883f09f6674f0606e4bc40
MD5 ffd4528a679a6f90afb83b183851e596
BLAKE2b-256 6ce0362e1ab78b750f2ff0f036ec1f2afc494886e3ed13cc07410637ca9893e2

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