Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Pack7Bit ¶
Pack7Bit packs an array of septets into an 8bit array as per the packing rules defined in 3GPP TS 23.038 Section 6.1.2.1 The padBits is the number of bits of pad to place at the beginning of the packed array, as the packed septets may not start on an octet boundary. Packed arrays containing 8n or 8n-1 digits both return 8n septets. The caller must be aware of the number of expected digits in order to distinguish between a 0 septet ending the sequence in the 8n case, and 0 padding in the 8n-1 case.
func Pack7BitUSSD ¶
Pack7BitUSSD packs an array of septets into an 8bit array as per the packing rules defined in 3GPP TS 23.038 Section 6.1.2.3 The padBits is the number of bits of pad to place at the beginning of the packed array, as the packed septets may not start on an octet boundary. A filler CR is added to the final octet if there are 7 bits unused (to distinguish from the 0x00 septet), or if the last septet is CR and ends on an octet boundary (so it wont be considered filler).
func Unpack7Bit ¶
Unpack7Bit unpacks septets, packed into an 8bit array as per the packing rules defined in 3GPP TS 23.038 Section 6.1.2.1, into an array of septets. The fillBits is the number of bits of pad at the beginning of the src, as the packed septets may not start on an octet boundary.
func Unpack7BitUSSD ¶
Unpack7BitUSSD unpacks septets, packed into an 8bit array, as per the packing rules defined in 3GPP TS 23.038 Section 6.1.2.3, into an array of septets. The fillBits is the number of bits of pad at the beginning of the src, as the packed septets may not start on an octet boundary. Any trailing CR is assumed to be filler if it ends an octet boundary, or if it starts on an octet boundary and the previous character is also CR.
Types ¶
type Decoder ¶
type Decoder struct {
// contains filtered or unexported fields
}
Decoder converts from GSM7 to UTF-8 using a particular character set.
func NewDecoder ¶
func NewDecoder() Decoder
NewDecoder returns a new GSM7 decoder which uses the default character set.
func (Decoder) Strict ¶
Strict makes the Decoder return an error if an unknown character is detected when looking up a septet in the character set (not the extension set).
func (Decoder) WithCharset ¶
WithCharset replaces the character set map used by the Decoder.
type Encoder ¶
type Encoder struct {
// contains filtered or unexported fields
}
Encoder converts from UTF-8 to GSM7 using a particular character set.
func NewEncoder ¶
func NewEncoder() Encoder
NewEncoder returns a new GSM7 encoder which uses the default character set.
func (*Encoder) Encode ¶
Encode converts the src from UTF-8 to GSM7 and writes the result to dst. The return value includes the encoded GSM7 bytes, and any error that occurred during encoding.
func (Encoder) WithCharset ¶
WithCharset replaces the character set map used by the Encoder.
type ErrInvalidSeptet ¶
type ErrInvalidSeptet byte
ErrInvalidSeptet indicates a septet cannot be decoded.
func (ErrInvalidSeptet) Error ¶
func (e ErrInvalidSeptet) Error() string
type ErrInvalidUTF8 ¶
type ErrInvalidUTF8 rune
ErrInvalidUTF8 indicates a rune cannot be converted to GSM7.
func (ErrInvalidUTF8) Error ¶
func (e ErrInvalidUTF8) Error() string