gsm7

package
v1.33.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 18, 2022 License: AGPL-3.0, AGPL-3.0-or-later Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(gsm7 []byte) (str string)

Decode decodes the passed in bytes as GSM7 encodings. Each byte is expected to be a single 7 bit GSM7 character.

func Encode

func Encode(str string) []byte

Encode encodes the given UTF-8 text into a string composed of GSM7 bytes. Each 7 bit GSM7 char is encoded in a single byte

func IsValid

func IsValid(text string) bool

IsValid returns whether the passed in string is made up of entirely GSM7 characters

func ReplaceSubstitutions

func ReplaceSubstitutions(text string) string

ReplaceSubstitutions replaces all the non-GSM7 characters that have valid substitutions with their GSM7 versions

func Segments

func Segments(text string) int

Segments calculates the number of SMS segments it will take to send the passed in text. This automatically figures out if the text is GSM7 or UCS2 and then calculates how many segments it will break up into.

UCS2 messages can be 70 characters per segnment max, if more, each segment is 67 GSM7 messages can be 160 characters per segmend max, if more, each segment is 153

TODO: likely some optimizations could be made here by comparing ranges instead of map lookups

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL