coding

package
v0.0.0-...-ac4ea29 Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DecodeGSM7

func DecodeGSM7(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 EncodeGSM7

func EncodeGSM7(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 IsValidGSM7

func IsValidGSM7(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

Types

type DataCoding

type DataCoding byte
const (
	GSM7BitCoding   DataCoding = 0b00000000 // 0 - GSM 7Bit 					(7 bit)
	ASCIICoding     DataCoding = 0b00000001 // 1 - ASCII (ISO-8859-9) 			(8 bit)
	OctetCoding     DataCoding = 0b00000010 // 2 - Octet unspecified 			(8-bit)
	Latin1Coding    DataCoding = 0b00000011 // 3 - Latin-1 (ISO-8859-1) 		(8 bit)
	OctetCoding4    DataCoding = 0b00000100 // 4 - Octet unspecified 			(8-bit)
	ShiftJISCoding  DataCoding = 0b00000101 // 5 - JIS (X 0208-1990)			(16 bit)
	CyrillicCoding  DataCoding = 0b00000110 // 6 - Cyrllic (ISO-8859-5)			(8 bit)
	HebrewCoding    DataCoding = 0b00000111 // 7 - Latin/Hebrew (ISO-8859-8)	(8 bit)
	UCS2Coding      DataCoding = 0b00001000 // 8 - UCS2/UTF-16 (ISO/IEC-10646)	(16 bit)
	ISO2022JPCoding DataCoding = 0b00001010 // 10 - Music Codes	(ISO-2022-JP)
	EUCJPCoding     DataCoding = 0b00001101 // 13 - Extended Kanji JIS (X 0212-1990)
	EUCKRCoding     DataCoding = 0b00001110 // 14 - Korean Graphic Character Set (KS C 5601/KS X 1001)
	NoCoding        DataCoding = 0b10111111 // 15-255 Reserved (Non-specification definition)
)

func BestAllCoding

func BestAllCoding(input string, isGSM7Supported bool) DataCoding

func BestCoding

func BestCoding(input string, isGSM7Supported bool) DataCoding

func BestSafeCoding

func BestSafeCoding(input string, isGSM7Supported bool) DataCoding

func GetDataCoding

func GetDataCoding(code int) DataCoding

func (DataCoding) Encoding

func (c DataCoding) Encoding() Encoding

Encoding ...

func (DataCoding) GoString

func (c DataCoding) GoString() string

func (DataCoding) MessageClass

func (c DataCoding) MessageClass() (coding DataCoding, class int)

MessageClass ...

func (DataCoding) MessageWaitingInfo

func (c DataCoding) MessageWaitingInfo() (coding DataCoding, active bool, kind int)

MessageWaitingInfo ...

func (DataCoding) Splitter

func (c DataCoding) Splitter() Splitter

Splitter ...

func (DataCoding) String

func (c DataCoding) String() string

func (DataCoding) Validate

func (c DataCoding) Validate(input string) bool

Validate ...

type Splitter

type Splitter func(rune) int

func (Splitter) Len

func (fn Splitter) Len(input string) (n int)

Length in bytes

func (Splitter) Split

func (fn Splitter) Split(input string, limit int, udhLength int) (segments []string)

160/153, 140/134, 70/67

Jump to

Keyboard shortcuts

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