Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More โ†’
Socket
Sign inDemoInstall
Socket

smsutil

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

smsutil

encode, decode and split SMS.

  • 1.1.3
  • PyPI
  • Socket score

Maintainers
1

smsutil - encode, decode and split SMS

.. image:: https://img.shields.io/badge/Say%20Thanks-!-1EAEDB.svg :target: https://saythanks.io/to/jezeniel

.. image:: https://img.shields.io/pypi/pyversions/smsutil :target: https://pypi.org/project/smsutil/

Simple set of utility functions for encoding, decoding and splitting sms messages. Shift tables is currently not supported.

Features

  • Codecs for encoding and decoding GSM 03.38 <https://en.wikipedia.org/wiki/GSM_03.38>_
  • Message splitting for both UCS2/UTF-16 and GSM 03.38

Installation

To install smsutil:

.. code-block:: bash

$ pip install smsutil

Basic Usage

Example for encoding and decoding:

.. code-block:: python

import smsutil

smsutil.is_valid_gsm('nobita and doraemon') # True smsutil.is_valid_gsm('๐Ÿ”') # False

gsm = smsutil.encode('the quick brown fox jumps over the lazy dog {@}')

b'the quick brown fox jumps over the lazy dog \x1b(\x00\x1b)'

smsutil.decode(gsm) # encoding='gsm0338'

'the quick brown fox jumps over the lazy dog {@}'

utf16 = smsutil.encode('ๆœ€้ซ˜ใงใ—ใŸ ๐Ÿ”')

b'g\x00\x9a\xd80g0W0_\x00 \xd8<\xdfT'

smsutil.decode(utf16, encoding='utf_16_be') # should specify encoding

'ๆœ€้ซ˜ใงใ—ใŸ ๐Ÿ”'

sms = smsutil.split('[the quick brown fox]') len(sms.parts) # 1 sms.encoding # 'gsm0338' sms.parts[0].content # '[the quick brown fox]' sms.parts[0].length # 21 sms.parts[0].bytes # 23

sms = smsutil.split('ๆœ€้ซ˜ใงใ—ใŸ ๐Ÿ”') len(sms.parts) # 1 sms.encoding # 'utf_16_be' sms.parts[0].content # 'ๆœ€้ซ˜ใงใ—ใŸ ๐Ÿ”' sms.parts[0].length # 7 sms.parts[0].bytes # 16

smsutil is just using python's builtin codecs for UCS2/UTF-16.

Contributing

  1. Fork repository.
  2. Create a pull request.
  3. โœจ๐Ÿฐโœจ

Keywords

FAQs


Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with โšก๏ธ by Socket Inc